コード例 #1
0
ファイル: ErrorReporter.java プロジェクト: rmancher/kc
  /**
   * Adds an audit error to the {@link KNSGlobalVariables.getAuditErrorMap()
   * KNSGlobalVariables.getAuditErrorMap()}.
   *
   * @param error the error to add.
   * @param errorKey the error map key
   * @param clusterLabel the cluster label
   * @param clusterCategory the cluster category
   * @throws IllegalArgumentException if error, errorKey, clusterLabel, or clusterCategory are null
   *     or if errorKey, clusterLabel, or clusterCategory are whitespace
   */
  public void reportAuditError(
      AuditError error, String errorKey, String clusterLabel, String clusterCategory) {
    if (error == null
        || StringUtils.isBlank(errorKey)
        || StringUtils.isBlank(clusterLabel)
        || StringUtils.isBlank(clusterCategory)) {
      throw new IllegalArgumentException(
          new StringBuilder("null argument error: ")
              .append(error)
              .append(" errorkey: ")
              .append(errorKey)
              .append(" clusterLabel: ")
              .append(clusterLabel)
              .append(" clusterCategory: ")
              .append(clusterCategory)
              .toString());
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("rule failure at " + ErrorReporter.getMethodPath(1, 2));
    }

    @SuppressWarnings("unchecked")
    final Map<String, AuditCluster> errorMap = KNSGlobalVariables.getAuditErrorMap();

    AuditCluster cluster = errorMap.get(errorKey);

    if (cluster == null) {
      cluster = new AuditCluster(clusterLabel, new ArrayList<AuditError>(), clusterCategory);
      errorMap.put(errorKey, cluster);
    }

    @SuppressWarnings("unchecked")
    final Collection<AuditError> errors = cluster.getAuditErrorList();
    errors.add(error);
  }
コード例 #2
0
ファイル: ErrorReporter.java プロジェクト: rmancher/kc
 /**
  * Wrapper around global errorMap.put call, to allow better logging.
  *
  * @param propertyName
  * @param errorKey
  * @param errorParams
  */
 public void reportWarning(String propertyName, String errorKey, String... errorParams) {
   GlobalVariables.getMessageMap().putWarning(propertyName, errorKey, errorParams);
   if (LOG.isDebugEnabled()) {
     LOG.debug(String.format("rule warning at ", ErrorReporter.getMethodPath(1, 2)));
   }
 }
コード例 #3
0
ファイル: ErrorReporter.java プロジェクト: rmancher/kc
 /**
  * Wrapper around global errorMap.put call, to allow better logging.
  *
  * @param propertyName
  * @param errorKey
  * @param errorParams
  */
 public void reportError(String propertyName, String errorKey, String... errorParams) {
   GlobalVariables.getMessageMap().putError(propertyName, errorKey, errorParams);
   if (LOG.isDebugEnabled()) {
     LOG.debug("rule failure at " + ErrorReporter.getMethodPath(1, 2));
   }
 }
コード例 #4
0
ファイル: ErrorReporter.java プロジェクト: rmancher/kc
 public void reportSoftError(String propertyName, String errorKey, String... errorParams) {
   addSoftError(propertyName, errorKey, errorParams);
   if (LOG.isDebugEnabled()) {
     LOG.debug("rule failure at " + ErrorReporter.getMethodPath(1, 2));
   }
 }