org.modeshape.jcr.api.Logger.warn()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中org.modeshape.jcr.api.Logger.warn()方法的一些代码示例,展示了Logger.warn()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.warn()方法的具体详情如下:
包路径:org.modeshape.jcr.api.Logger
类名称:Logger
方法名:warn

Logger.warn介绍

[英]Log a message at the WARNING level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. The pattern consists of zero or more keys of the form {n}, where n is an integer starting at 0. Therefore, the first parameter replaces all occurrences of "{0}", the second parameter replaces all occurrences of "{1}", etc.

If any parameter is null, the corresponding key is replaced with the string "null". Therefore, consider using an empty string when keys are to be removed altogether.
[中]根据指定的格式和(可选)参数以警告级别记录消息。消息应该为每个参数包含一对空大括号,并且应该按照正确的顺序传递。该模式由格式为{n}的零个或多个键组成,其中n是从0开始的整数。因此,第一个参数替换所有出现的“{0}”,第二个参数替换所有出现的“{1}”,等等。
如果任何参数为null,则相应的键将替换为字符串“null”。因此,当键被完全移除时,考虑使用一个空字符串。

代码示例

代码示例来源:origin: ModeShape/modeshape

  1. /**
  2. * Cleans up any resources related to {@link AbstractHandler#ACTIVE_SESSION}
  3. */
  4. public static void cleanupActiveSession() {
  5. Session session = AbstractHandler.ACTIVE_SESSION.get();
  6. if (session != null) {
  7. try {
  8. AbstractHandler.ACTIVE_SESSION.remove();
  9. session.logout();
  10. LOGGER.debug("Logged out REST service session");
  11. } catch (Exception e) {
  12. LOGGER.warn(e, "Error while trying to logout REST service session");
  13. }
  14. }
  15. }

代码示例来源:origin: ModeShape/modeshape

  1. private String restValueForReference( Value value,
  2. String baseUrl,
  3. Session session ) throws RepositoryException {
  4. String nodeId = value.getString();
  5. Node referredNode = session.getNodeByIdentifier(nodeId);
  6. if (referredNode != null) {
  7. return RestHelper.urlFrom(baseUrl, ITEMS_METHOD_NAME, encodedPath(referredNode.getPath()));
  8. }
  9. logger.warn("Cannot resolve reference with id: {0}", nodeId);
  10. return nodeId;
  11. }

代码示例来源:origin: ModeShape/modeshape

  1. private String restValueForBinary( String absPropertyPath,
  2. String baseUrl ) {
  3. if (absPropertyPath == null) {
  4. logger.warn("Cannot generate rest representation of a binary value, because the property is unknown");
  5. return null;
  6. }
  7. return RestHelper.urlFrom(baseUrl, BINARY_METHOD_NAME, encodedPath(absPropertyPath));
  8. }

代码示例来源:origin: ModeShape/modeshape

  1. /**
  2. * Sets the reader's named feature to the supplied value, only if the feature is not already set to that value. This method
  3. * does nothing if the feature is not known to the reader.
  4. *
  5. * @param reader the reader; may not be null
  6. * @param featureName the name of the feature; may not be null
  7. * @param value the value for the feature
  8. */
  9. void setFeature( XMLReader reader,
  10. String featureName,
  11. boolean value ) {
  12. try {
  13. if (reader.getFeature(featureName) != value) {
  14. reader.setFeature(featureName, value);
  15. }
  16. } catch (SAXException e) {
  17. getLogger().warn(e, "Cannot set feature " + featureName);
  18. }
  19. }

代码示例来源:origin: org.modeshape/modeshape-sequencer-xml

  1. /**
  2. * Sets the reader's named feature to the supplied value, only if the feature is not already set to that value. This method
  3. * does nothing if the feature is not known to the reader.
  4. *
  5. * @param reader the reader; may not be null
  6. * @param featureName the name of the feature; may not be null
  7. * @param value the value for the feature
  8. */
  9. void setFeature( XMLReader reader,
  10. String featureName,
  11. boolean value ) {
  12. try {
  13. if (reader.getFeature(featureName) != value) {
  14. reader.setFeature(featureName, value);
  15. }
  16. } catch (SAXException e) {
  17. getLogger().warn(e, "Cannot set feature " + featureName);
  18. }
  19. }

代码示例来源:origin: ModeShape/modeshape

  1. private void setPropertyIfMetadataPresent(Node node,
  2. String propertyName,
  3. Object value) throws RepositoryException {
  4. if (value == null) {
  5. return;
  6. }
  7. if (value instanceof String && !StringUtil.isBlank((String) value)) {
  8. node.setProperty(propertyName, (String) value);
  9. } else if (value instanceof Double) {
  10. node.setProperty(propertyName, (Double) value);
  11. } else if (value instanceof Number) {
  12. node.setProperty(propertyName, ((Number) value).longValue());
  13. } else if (value instanceof byte[]) {
  14. InputStream is = new ByteArrayInputStream((byte[]) value);
  15. Binary binaryProperty = (Binary) node.getSession().getValueFactory().createBinary(is);
  16. node.setProperty(propertyName, binaryProperty);
  17. } else {
  18. getLogger().warn("The value of the property {0} has unknown type and couldn't be saved.", propertyName);
  19. }
  20. }

代码示例来源:origin: ModeShape/modeshape

  1. getLogger().warn("The value of the property {0} has unknown type and couldn't be saved.", propertyName);

代码示例来源:origin: ModeShape/modeshape

  1. getLogger().warn("The value of the property {0} has unknown type and couldn't be saved", propertyName);

代码示例来源:origin: ModeShape/modeshape

  1. /**
  2. * Returns the default mime-type of a given binary property.
  3. *
  4. * @param binaryProperty a non-null {@link Property}
  5. * @return a non-null String which represents the mime-type of the binary property.
  6. * @throws RepositoryException if any JCR related operation involving the binary property fail.
  7. */
  8. public String getDefaultMimeType( Property binaryProperty ) throws RepositoryException {
  9. try {
  10. Binary binary = binaryProperty.getBinary();
  11. return binary instanceof org.modeshape.jcr.api.Binary ? ((org.modeshape.jcr.api.Binary)binary)
  12. .getMimeType() : DEFAULT_MIME_TYPE;
  13. } catch (IOException e) {
  14. logger.warn("Cannot determine default mime-type", e);
  15. return DEFAULT_MIME_TYPE;
  16. }
  17. }

代码示例来源:origin: ModeShape/modeshape

  1. getLogger().warn("The value of the property {0} has unknown type and couldn't be saved.", propertyName);

代码示例来源:origin: ModeShape/modeshape

  1. @Override
  2. public boolean execute( Property inputProperty,
  3. Node outputNode,
  4. Context context ) throws Exception {
  5. Binary binaryValue = inputProperty.getBinary();
  6. CheckArg.isNotNull(binaryValue, "binary");
  7. Node sequencedNode = getPdfMetadataNode(outputNode);
  8. try {
  9. if (processBasicMetadata(sequencedNode, binaryValue)) {
  10. processXMPMetadata(sequencedNode, binaryValue);
  11. return true;
  12. } else {
  13. getLogger().warn("Ignoring pdf from node {0} because basic metadata cannot be extracted",
  14. inputProperty.getParent().getPath());
  15. return false;
  16. }
  17. } catch (java.lang.NoClassDefFoundError ncdfe) {
  18. if (ncdfe.getMessage().toLowerCase().contains("bouncycastle")) {
  19. getLogger().warn("Ignoring pdf from node {0} because it's encrypted and encrypted PDFs are not supported",
  20. inputProperty.getParent().getPath());
  21. return false;
  22. }
  23. throw ncdfe;
  24. }
  25. }

代码示例来源:origin: ModeShape/modeshape

  1. logger.warn("The child object {0} has more than 1 elements, only the first one will be taken into account",
  2. child);

代码示例来源:origin: org.modeshape/modeshape-sequencer-text

  1. @Override
  2. public boolean execute( Property inputProperty, Node outputNode, Context context ) throws Exception {
  3. Binary binaryValue = inputProperty.getBinary();
  4. CheckArg.isNotNull(binaryValue, "binary");
  5. int rowCount = 0;
  6. RowFactory rowFactory = createRowFactory();
  7. String line = null;
  8. BufferedReader reader = null;
  9. try {
  10. reader = new BufferedReader(new InputStreamReader(binaryValue.getStream()));
  11. while ((line = reader.readLine()) != null) {
  12. if (isComment(line)) {
  13. continue;
  14. }
  15. if (shouldReadLine(++rowCount)) {
  16. String[] columns = parseLine(line);
  17. rowFactory.recordRow(outputNode, columns);
  18. }
  19. }
  20. } finally {
  21. try {
  22. if (reader != null) {
  23. reader.close();
  24. }
  25. } catch (Exception e) {
  26. getLogger().warn(e, "Cannot close reader ");
  27. }
  28. }
  29. return true;
  30. }

代码示例来源:origin: ModeShape/modeshape

  1. @Override
  2. public boolean execute( Property inputProperty, Node outputNode, Context context ) throws Exception {
  3. Binary binaryValue = inputProperty.getBinary();
  4. CheckArg.isNotNull(binaryValue, "binary");
  5. int rowCount = 0;
  6. RowFactory rowFactory = createRowFactory();
  7. String line = null;
  8. BufferedReader reader = null;
  9. try {
  10. reader = new BufferedReader(new InputStreamReader(binaryValue.getStream()));
  11. while ((line = reader.readLine()) != null) {
  12. if (isComment(line)) {
  13. continue;
  14. }
  15. if (shouldReadLine(++rowCount)) {
  16. String[] columns = parseLine(line);
  17. rowFactory.recordRow(outputNode, columns);
  18. }
  19. }
  20. } finally {
  21. try {
  22. if (reader != null) {
  23. reader.close();
  24. }
  25. } catch (Exception e) {
  26. getLogger().warn(e, "Cannot close reader ");
  27. }
  28. }
  29. return true;
  30. }

代码示例来源:origin: org.fcrepo/modeshape-jcr

  1. .submit(new MonitoringTask(watchService, this, Paths.get(directoryAbsolutePath)));
  2. } catch (UnsupportedOperationException e) {
  3. log().warn("Unable to to turn on monitoring, because it is not supported on this OS");

代码示例来源:origin: ModeShape/modeshape

  1. .submit(new MonitoringTask(watchService, this, Paths.get(directoryAbsolutePath)));
  2. } catch (UnsupportedOperationException e) {
  3. log().warn("Unable to to turn on monitoring, because it is not supported on this OS");

代码示例来源:origin: org.fcrepo/modeshape-jcr

  1. connector.log().warn("Cannot get binary value for '{0}'", resolvedPath);

代码示例来源:origin: ModeShape/modeshape

  1. connector.log().warn("Cannot get binary value for '{0}'", resolvedPath);

代码示例来源:origin: ModeShape/modeshape

  1. getLogger().warn("Unknown mimetype: {0} for microsoft office", mimeType);
  2. return false;

代码示例来源:origin: org.modeshape/modeshape-sequencer-msoffice

  1. getLogger().warn("Unknown mimetype: {0} for microsoft office", mimeType);
  2. return false;

相关文章