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

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

本文整理了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

/**
 * Cleans up any resources related to {@link AbstractHandler#ACTIVE_SESSION}
 */
public static void cleanupActiveSession() {
  Session session = AbstractHandler.ACTIVE_SESSION.get();
  if (session != null) {
    try {
      AbstractHandler.ACTIVE_SESSION.remove();
      session.logout();
      LOGGER.debug("Logged out REST service session");
    } catch (Exception e) {
      LOGGER.warn(e, "Error while trying to logout REST service session");
    }
  }
}

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

private String restValueForReference( Value value,
                   String baseUrl,
                   Session session ) throws RepositoryException {
  String nodeId = value.getString();
  Node referredNode = session.getNodeByIdentifier(nodeId);
  if (referredNode != null) {
    return RestHelper.urlFrom(baseUrl, ITEMS_METHOD_NAME, encodedPath(referredNode.getPath()));
  }
  logger.warn("Cannot resolve reference with id: {0}", nodeId);
  return nodeId;
}

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

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

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

/**
 * Sets the reader's named feature to the supplied value, only if the feature is not already set to that value. This method
 * does nothing if the feature is not known to the reader.
 * 
 * @param reader the reader; may not be null
 * @param featureName the name of the feature; may not be null
 * @param value the value for the feature
 */
void setFeature( XMLReader reader,
         String featureName,
         boolean value ) {
  try {
    if (reader.getFeature(featureName) != value) {
      reader.setFeature(featureName, value);
    }
  } catch (SAXException e) {
    getLogger().warn(e, "Cannot set feature " + featureName);
  }
}

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

/**
 * Sets the reader's named feature to the supplied value, only if the feature is not already set to that value. This method
 * does nothing if the feature is not known to the reader.
 * 
 * @param reader the reader; may not be null
 * @param featureName the name of the feature; may not be null
 * @param value the value for the feature
 */
void setFeature( XMLReader reader,
         String featureName,
         boolean value ) {
  try {
    if (reader.getFeature(featureName) != value) {
      reader.setFeature(featureName, value);
    }
  } catch (SAXException e) {
    getLogger().warn(e, "Cannot set feature " + featureName);
  }
}

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

private void setPropertyIfMetadataPresent(Node node,
                     String propertyName,
                     Object value) throws RepositoryException {
  if (value == null) {
    return;
  }
  if (value instanceof String && !StringUtil.isBlank((String) value)) {
    node.setProperty(propertyName, (String) value);
  } else if (value instanceof Double) {
    node.setProperty(propertyName, (Double) value);
  } else if (value instanceof Number) {
    node.setProperty(propertyName, ((Number) value).longValue());
  } else if (value instanceof byte[]) {
    InputStream is = new ByteArrayInputStream((byte[]) value);
    Binary binaryProperty = (Binary) node.getSession().getValueFactory().createBinary(is);
    node.setProperty(propertyName, binaryProperty);
  } else {
    getLogger().warn("The value of the property {0} has unknown type and couldn't be saved.", propertyName);
  }
}

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

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

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

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

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

/**
 * Returns the default mime-type of a given binary property.
 *
 * @param binaryProperty a non-null {@link Property}
 * @return a non-null String which represents the mime-type of the binary property.
 * @throws RepositoryException if any JCR related operation involving the binary property fail.
 */
public String getDefaultMimeType( Property binaryProperty ) throws RepositoryException {
  try {
    Binary binary = binaryProperty.getBinary();
    return binary instanceof org.modeshape.jcr.api.Binary ? ((org.modeshape.jcr.api.Binary)binary)
        .getMimeType() : DEFAULT_MIME_TYPE;
  } catch (IOException e) {
    logger.warn("Cannot determine default mime-type", e);
    return DEFAULT_MIME_TYPE;
  }
}

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

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

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

@Override
public boolean execute( Property inputProperty,
            Node outputNode,
            Context context ) throws Exception {
  Binary binaryValue = inputProperty.getBinary();
  CheckArg.isNotNull(binaryValue, "binary");
  Node sequencedNode = getPdfMetadataNode(outputNode);
  try {
    if (processBasicMetadata(sequencedNode, binaryValue)) {
      processXMPMetadata(sequencedNode, binaryValue);
      return true;
    } else {
      getLogger().warn("Ignoring pdf from node {0} because basic metadata cannot be extracted",
               inputProperty.getParent().getPath());
      return false;
    }
  } catch (java.lang.NoClassDefFoundError ncdfe) {
    if (ncdfe.getMessage().toLowerCase().contains("bouncycastle")) {
      getLogger().warn("Ignoring pdf from node {0} because it's encrypted and encrypted PDFs are not supported", 
               inputProperty.getParent().getPath());
      return false;
    }
    throw ncdfe;
  }
}

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

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

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

@Override
public boolean execute( Property inputProperty, Node outputNode, Context context ) throws Exception {
  Binary binaryValue = inputProperty.getBinary();
  CheckArg.isNotNull(binaryValue, "binary");
  int rowCount = 0;
  RowFactory rowFactory = createRowFactory();
  String line = null;
  BufferedReader reader = null;
  try {
    reader = new BufferedReader(new InputStreamReader(binaryValue.getStream()));
    while ((line = reader.readLine()) != null) {
      if (isComment(line)) {
        continue;
      }
      if (shouldReadLine(++rowCount)) {
        String[] columns = parseLine(line);
        rowFactory.recordRow(outputNode, columns);
      }
    }
  } finally {
    try {
      if (reader != null) {
        reader.close();
      }
    } catch (Exception e) {
      getLogger().warn(e, "Cannot close reader ");
    }
  }
  return true;
}

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

@Override
public boolean execute( Property inputProperty, Node outputNode, Context context ) throws Exception {
  Binary binaryValue = inputProperty.getBinary();
  CheckArg.isNotNull(binaryValue, "binary");
  int rowCount = 0;
  RowFactory rowFactory = createRowFactory();
  String line = null;
  BufferedReader reader = null;
  try {
    reader = new BufferedReader(new InputStreamReader(binaryValue.getStream()));
    while ((line = reader.readLine()) != null) {
      if (isComment(line)) {
        continue;
      }
      if (shouldReadLine(++rowCount)) {
        String[] columns = parseLine(line);
        rowFactory.recordRow(outputNode, columns);
      }
    }
  } finally {
    try {
      if (reader != null) {
        reader.close();
      }
    } catch (Exception e) {
      getLogger().warn(e, "Cannot close reader ");
    }
  }
  return true;
}

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

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

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

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

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

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

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

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

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

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

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

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

相关文章