Java Code Examples for org.jfree.util.Log#error()
The following examples show how to use
org.jfree.util.Log#error() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ManagedPropertiesMessageCoordinator.java From olat with Apache License 2.0 | 6 votes |
/** */ @Override public void onMessage(Message message) { try { if (message instanceof TextMessage) { TextMessage tm = (TextMessage) message; // TODO use MapMessage and allow update of more then one property at one String propertyName = tm.getText(); String value = tm.getStringProperty(propertyName); System.out.printf("***************** Processed message (listener 1) 'key=%s' 'value=%s'. hashCode={%d}\n", propertyName, value, this.hashCode()); propertiesLoader.setProperty(propertyName, value); } } catch (JMSException e) { Log.error("Error while processing jms message ", e); } }
Example 2
Source File: PropertyManagerEBL.java From olat with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") public List<String> getCourseCalendarSubscriptionProperty(final PropertyParameterObject propertyParameterObject) { List<String> infoSubscriptions = new ArrayList<String>(); List<PropertyImpl> properties = findProperties(propertyParameterObject); if (properties.size() > 1) { Log.error("more than one property found, something went wrong, deleting them and starting over."); for (PropertyImpl prop : properties) { propertyManager.deleteProperty(prop); } } else if (properties.size() == 0l) { createAndSaveProperty(propertyParameterObject); properties = findProperties(propertyParameterObject); } String value = properties.get(0).getTextValue(); if (value != null && !value.equals("")) { String[] subscriptions = properties.get(0).getTextValue().split(SEPARATOR); infoSubscriptions.addAll(Arrays.asList(subscriptions)); } return infoSubscriptions; }
Example 3
Source File: ManagedPropertiesMessageCoordinator.java From olat with Apache License 2.0 | 6 votes |
/** */ @Override public void onMessage(Message message) { try { if (message instanceof TextMessage) { TextMessage tm = (TextMessage) message; // TODO use MapMessage and allow update of more then one property at one String propertyName = tm.getText(); String value = tm.getStringProperty(propertyName); System.out.printf("***************** Processed message (listener 1) 'key=%s' 'value=%s'. hashCode={%d}\n", propertyName, value, this.hashCode()); propertiesLoader.setProperty(propertyName, value); } } catch (JMSException e) { Log.error("Error while processing jms message ", e); } }
Example 4
Source File: PropertyManagerEBL.java From olat with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") public List<String> getCourseCalendarSubscriptionProperty(final PropertyParameterObject propertyParameterObject) { List<String> infoSubscriptions = new ArrayList<String>(); List<PropertyImpl> properties = findProperties(propertyParameterObject); if (properties.size() > 1) { Log.error("more than one property found, something went wrong, deleting them and starting over."); for (PropertyImpl prop : properties) { propertyManager.deleteProperty(prop); } } else if (properties.size() == 0l) { createAndSaveProperty(propertyParameterObject); properties = findProperties(propertyParameterObject); } String value = properties.get(0).getTextValue(); if (value != null && !value.equals("")) { String[] subscriptions = properties.get(0).getTextValue().split(SEPARATOR); infoSubscriptions.addAll(Arrays.asList(subscriptions)); } return infoSubscriptions; }
Example 5
Source File: InfoSubscription.java From olat with Apache License 2.0 | 6 votes |
/** * @return */ private List<String> getProperty(String key) { List<String> infoSubscriptions = new ArrayList<String>(); List<PropertyImpl> properties = propertyManager.findProperties(ident, null, null, null, key); if (properties.size() > 1) { Log.error("more than one property found, something went wrong, deleting them and starting over."); for (PropertyImpl prop : properties) { propertyManager.deleteProperty(prop); } } else if (properties.size() == 0l) { PropertyImpl p = propertyManager.createPropertyInstance(ident, null, null, null, key, null, null, null, null); propertyManager.saveProperty(p); properties = propertyManager.findProperties(ident, null, null, null, key); } String value = properties.get(0).getTextValue(); if (value != null && !value.equals("")) { String[] subscriptions = properties.get(0).getTextValue().split(SEPARATOR); infoSubscriptions.addAll(Arrays.asList(subscriptions)); } return infoSubscriptions; }
Example 6
Source File: StreamingJsonCompleteDataSetRegistration.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void writeField( String fieldName, Boolean value ) { if ( value == null ) { return; } try { generator.writeObjectField( fieldName, value ); } catch ( IOException e ) { Log.error( e.getMessage() ); } }
Example 7
Source File: StreamingJsonCompleteDataSetRegistration.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override protected void writeField( String fieldName, String value ) { if ( value == null ) { return; } try { generator.writeObjectField( fieldName, value ); } catch ( IOException e ) { Log.error( e.getMessage() ); } }
Example 8
Source File: MetadataHandler.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
protected SOSMetadata initMetadata() { String sosUrl = getServiceUrl(); String sosVersion = getServiceVersion(); serviceDescriptor = ConnectorUtils.getServiceDescriptor(sosUrl, getSosAdapter()); String sosTitle = serviceDescriptor.getServiceIdentification().getTitle(); String omResponseFormat = ConnectorUtils.getResponseFormat(serviceDescriptor, "om"); String smlVersion = ConnectorUtils.getSMLVersion(serviceDescriptor, sosVersion); // set defaults if format/version could not be determined from capabilities if (omResponseFormat == null) { omResponseFormat = "http://www.opengis.net/om/2.0"; } if (smlVersion == null) { smlVersion = "http://www.opengis.net/sensorML/1.0.1"; } try { sosMetadata = (SOSMetadata) ConfigurationContext.getServiceMetadatas().get(sosUrl); if (sosMetadata != null) { sosMetadata.setTitle(sosTitle); sosMetadata.setSensorMLVersion(smlVersion); sosMetadata.setOmVersion(omResponseFormat); sosMetadata.setSosVersion(sosVersion); sosMetadata.setInitialized(true); } else { sosMetadata = new SOSMetadata(sosUrl, sosVersion, smlVersion, omResponseFormat, sosTitle); ConfigurationContext.initializeMetadata(sosMetadata); } } catch (Exception e) { Log.error("Cannot cast SOSMetadata", e); } return sosMetadata; }
Example 9
Source File: ChartConstants.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * @return java.awt.Stroke for JFreeChart renderer to draw lines */ public static Stroke translateLineStyle( float lineWidth, final String lineStyle ) { // Negative linewidths not allowed, reset to default. if ( lineWidth < 0 ) { Log.error( ( "LineChartExpression.ERROR_0001_INVALID_LINE_WIDTH" ) ); //$NON-NLS-1$ lineWidth = 1.0f; } final int strokeType; if ( LINE_STYLE_DASH_STR.equals( lineStyle ) ) { strokeType = StrokeUtility.STROKE_DASHED; } else if ( LINE_STYLE_DOT_STR.equals( lineStyle ) ) { strokeType = StrokeUtility.STROKE_DOTTED; } else if ( LINE_STYLE_DASHDOT_STR.equals( lineStyle ) ) { strokeType = StrokeUtility.STROKE_DOT_DASH; } else if ( LINE_STYLE_DASHDOTDOT_STR.equals( lineStyle ) ) { strokeType = StrokeUtility.STROKE_DOT_DOT_DASH; } else { if ( lineWidth == 0 ) { strokeType = StrokeUtility.STROKE_NONE; } else { strokeType = StrokeUtility.STROKE_SOLID; } } return StrokeUtility.createStroke( strokeType, lineWidth ); }
Example 10
Source File: MTGDavFolderResource.java From MtgDesktopCompanion with GNU General Public License v3.0 | 5 votes |
@Override public void delete() throws NotAuthorizedException, ConflictException, BadRequestException { try { Files.deleteIfExists(mtgpath); } catch (IOException e) { Log.error("error delete()",e); throw new BadRequestException(this); } }
Example 11
Source File: PIDGraph.java From BowlerStudio with GNU General Public License v3.0 | 5 votes |
public void run(){ while (true){ ThreadUtil.wait(50); if(lastData[0] != data[0] || lastData[1]!=data[1]){ lastData[0]=data[0]; lastData[1]=data[1]; try{ double time = (System.currentTimeMillis()-startTime); dataTable.add(new GraphDataElement((long) time,data)); XYDataItem s = new XYDataItem(time,data[0]); XYDataItem p = new XYDataItem(time,data[1]); if(setpoints.getItemCount()>99){ setpoints.remove(0); } setpoints.add(s); if(positions.getItemCount()>99){ positions.remove(0); } positions.add(p); }catch(Exception e){ System.err.println("Failed to set a data point"); e.printStackTrace(); Log.error(e); Log.error(e.getStackTrace()); init(); } } } }
Example 12
Source File: GitLabSecurityRealm.java From gitlab-oauth-plugin with MIT License | 5 votes |
private String extractToken(String content) { try { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonTree = mapper.readTree(content); JsonNode node = jsonTree.get("access_token"); if (node != null) { return node.asText(); } } catch (IOException e) { Log.error(e.getMessage(), e); } return null; }
Example 13
Source File: AbstractObjectDescription.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Returns a cloned instance of the object description. The contents * of the parameter objects collection are cloned too, so that any * already defined parameter value is copied to the new instance. * <p> * Parameter definitions are not cloned, as they are considered read-only. * <p> * The newly instantiated object description is not configured. If it * need to be configured, then you have to call configure on it. * * @return A cloned instance. */ public ObjectDescription getUnconfiguredInstance() { try { final AbstractObjectDescription c = (AbstractObjectDescription) super.clone(); c.parameters = (HashMap) this.parameters.clone(); c.config = null; return c; } catch (Exception e) { Log.error("Should not happen: Clone Error: ", e); return null; } }
Example 14
Source File: BeanObjectDescription.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
private void readBeanDescription(final Class className, final boolean init) { try { this.properties = new HashMap(); final BeanInfo bi = Introspector.getBeanInfo(className); final PropertyDescriptor[] propertyDescriptors = bi.getPropertyDescriptors(); for (int i = 0; i < propertyDescriptors.length; i++) { final PropertyDescriptor propertyDescriptor = propertyDescriptors[i]; final Method readMethod = propertyDescriptor.getReadMethod(); final Method writeMethod = propertyDescriptor.getWriteMethod(); if (isValidMethod(readMethod, 0) && isValidMethod(writeMethod, 1)) { final String name = propertyDescriptor.getName(); this.properties.put(name, propertyDescriptor); if (init) { super.setParameterDefinition(name, propertyDescriptor.getPropertyType()); } } } } catch (IntrospectionException e) { Log.error ("Unable to build bean description", e); } }
Example 15
Source File: BeanObjectDescription.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Creates an object based on this description. * * @return The object. */ public Object createObject() { try { final Object o = getObjectClass().newInstance(); // now add the various parameters ... final Iterator it = getParameterNames(); while (it.hasNext()) { final String name = (String) it.next(); if (isParameterIgnored(name)) { continue; } final Method method = findSetMethod(name); final Object parameterValue = getParameter(name); if (parameterValue == null) { // Log.debug ("Parameter: " + name + " is null"); } else { method.invoke(o, new Object[]{parameterValue}); } } return o; } catch (Exception e) { Log.error("Unable to invoke bean method", e); } return null; }
Example 16
Source File: RepeatUntilOperatorChain.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
@Override public void performAdditionalChecks() { if (!getParameterAsBoolean(PARAMETER_CONDITION_PERFORMANCE) && !getParameterAsBoolean(PARAMETER_CONDITION_EXAMPLES)) { this.addError(new SimpleProcessSetupError(Severity.ERROR, getPortOwner(), "need_one_parameter", PARAMETER_CONDITION_EXAMPLES, PARAMETER_CONDITION_PERFORMANCE)); } try { if (getParameterAsBoolean(PARAMETER_CONDITION_PERFORMANCE)) { double maxCrit = getParameterAsDouble(PARAMETER_MAX_CRITERION); double minCrit = getParameterAsDouble(PARAMETER_MIN_CRITERION); if (maxCrit < Double.POSITIVE_INFINITY || minCrit > Double.NEGATIVE_INFINITY) { if (maxCrit < minCrit) { this.addError(new SimpleProcessSetupError(Severity.ERROR, getPortOwner(), "parameter_combination_forbidden_range", PARAMETER_MIN_CRITERION, PARAMETER_MAX_CRITERION)); } } } if (getParameterAsBoolean(PARAMETER_CONDITION_EXAMPLES)) { int maxAtts = getParameterAsInt(PARAMETER_MAX_ATTRIBUTES); int minAtts = getParameterAsInt(PARAMETER_MIN_ATTRIBUTES); if (maxAtts < Double.POSITIVE_INFINITY || minAtts > Double.NEGATIVE_INFINITY) { if (maxAtts < minAtts) { this.addError(new SimpleProcessSetupError(Severity.ERROR, getPortOwner(), "parameter_combination_forbidden_range", PARAMETER_MIN_ATTRIBUTES, PARAMETER_MAX_ATTRIBUTES)); } } int maxEx = getParameterAsInt(PARAMETER_MAX_EXAMPLES); int minEx = getParameterAsInt(PARAMETER_MIN_EXAMPLES); if (maxEx < Double.POSITIVE_INFINITY || minEx > Double.NEGATIVE_INFINITY) { if (maxEx < minEx) { this.addError(new SimpleProcessSetupError(Severity.ERROR, getPortOwner(), "parameter_combination_forbidden_range", PARAMETER_MIN_EXAMPLES, PARAMETER_MAX_EXAMPLES)); } } } } catch (UndefinedParameterError e) { Log.error("parameter undefined", e); } }
Example 17
Source File: CommitWidget.java From BowlerStudio with GNU General Public License v3.0 | 4 votes |
public static void commit(File currentFile, String code){ if(code.length()<1){ Log.error("COmmit failed with no code to commit"); return; } Platform.runLater(() ->{ // Create the custom dialog. Dialog<Pair<String, String>> dialog = new Dialog<>(); dialog.setTitle("Commit message Dialog"); dialog.setHeaderText("Enter a commit message to publish changes"); // Set the button types. ButtonType loginButtonType = new ButtonType("Publish", ButtonData.OK_DONE); dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL); // Create the username and password labels and fields. GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(20, 150, 10, 10)); TextField username = new TextField(); username.setPromptText("60 character description"); TextArea password = new TextArea(); password.setPrefRowCount(5); password.setPrefColumnCount(40); password.setPromptText("Full Sentences describing explanation"); grid.add(new Label("What did you change?"), 0, 0); grid.add(username, 1, 0); grid.add(new Label("Why did you change it?"), 0, 1); grid.add(password, 1, 1); // Enable/Disable login button depending on whether a username was entered. Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType); loginButton.setDisable(true); // Do some validation (using the Java 8 lambda syntax). username.textProperty().addListener((observable, oldValue, newValue) -> { loginButton.setDisable(newValue.trim().length()<5); }); dialog.getDialogPane().setContent(grid); // Request focus on the username field by default. Platform.runLater(() -> username.requestFocus()); // Convert the result to a username-password-pair when the login button is clicked. dialog.setResultConverter(dialogButton -> { if (dialogButton == loginButtonType) { return new Pair<>(username.getText(), password.getText()); } return null; }); Optional<Pair<String, String>> result = dialog.showAndWait(); result.ifPresent(commitBody -> { new Thread(){ public void run(){ Thread.currentThread().setUncaughtExceptionHandler(new IssueReportingExceptionHandler()); String message = commitBody.getKey()+"\n\n"+commitBody.getValue(); Git git; try { git = ScriptingEngine.locateGit(currentFile); String remote= git.getRepository().getConfig().getString("remote", "origin", "url"); String relativePath = ScriptingEngine.findLocalPath(currentFile,git); ScriptingEngine.pushCodeToGit(remote,ScriptingEngine.getFullBranch(remote), relativePath, code, message); git.close(); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }.start(); }); }); }
Example 18
Source File: TicketDownload.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void downloadDocument(HttpServletRequest request, HttpServletResponse response, Document doc, String fileVersion, String suffix, String ticket) throws FileNotFoundException, IOException, ServletException { Storer storer = (Storer) Context.get().getBean(Storer.class); String resource = storer.getResourceName(doc, fileVersion, suffix); String filename = doc.getFileName(); if (suffix != null && suffix.contains("pdf")) filename = doc.getFileName() + ".pdf"; InputStream is = null; OutputStream os = null; try { long size = storer.size(doc.getId(), resource); is = storer.getStream(doc.getId(), resource); // get the mimetype String mimetype = MimeType.getByFilename(filename); // it seems everything is fine, so we can now start writing to the // response object response.setContentType(mimetype); ServletUtil.setContentDisposition(request, response, filename); // Chrome and Safary need these headers to allow to skip backwards // or // forwards multimedia contents response.setHeader("Accept-Ranges", "bytes"); response.setHeader("Content-Length", Long.toString(size)); os = response.getOutputStream(); int letter = 0; while ((letter = is.read()) != -1) { os.write(letter); } } finally { if (os != null) os.flush(); os.close(); if (is != null) is.close(); } // Add an history entry to track the download of the document DocumentHistory history = new DocumentHistory(); history.setDocId(doc.getId()); history.setFilename(doc.getFileName()); history.setVersion(doc.getVersion()); FolderDAO fdao = (FolderDAO) Context.get().getBean(FolderDAO.class); history.setPath(fdao.computePathExtended(doc.getFolder().getId())); history.setEvent(DocumentEvent.DOWNLOADED.toString()); history.setFilename(doc.getFileName()); history.setFolderId(doc.getFolder().getId()); history.setComment("Ticket " + ticket); DocumentHistoryDAO hdao = (DocumentHistoryDAO) Context.get().getBean(DocumentHistoryDAO.class); try { hdao.store(history); } catch (PersistenceException e) { Log.error(e.getMessage(), e); } }
Example 19
Source File: AbstractObjectDescription.java From ccu-historian with GNU General Public License v3.0 | 3 votes |
/** * Returns a cloned instance of the object description. The contents * of the parameter objects collection are cloned too, so that any * already defined parameter value is copied to the new instance. * <p> * Parameter definitions are not cloned, as they are considered read-only. * <p> * The newly instantiated object description is not configured. If it * need to be configured, then you have to call configure on it. * * @return A cloned instance. */ public ObjectDescription getInstance() { try { final AbstractObjectDescription c = (AbstractObjectDescription) super.clone(); c.parameters = (HashMap) this.parameters.clone(); return c; } catch (Exception e) { Log.error("Should not happen: Clone Error: ", e); return null; } }