private void validateWithSchema(JsonNode model) { createValidator(); try { ProcessingReport report = validator.validate(model); if (report != null) { List<String> msgs = Lists.newArrayList(); report.forEach(msg -> { if (msg.getLogLevel().compareTo(LogLevel.ERROR) >= 0) { String ptr = msg.asJson().at("/instance/pointer").asText(); msgs.add(String.format("At %s: %s", ptr.isEmpty() ? "/" : ptr, msg.getMessage())); } }); if (!msgs.isEmpty()) { throw new RealizationModelParseException(msgs); } } } catch (ProcessingException e) { e.printStackTrace(); } }
private static void validate(CanonicalPath dataPath, JsonNode dataNode, JsonNode schemaNode) { //explicitly allow null schemas if (dataNode == null || dataNode.isNull()) { return; } try { ProcessingReport report = VALIDATOR.validate(schemaNode, dataNode, true); if (!report.isSuccess()) { List<ValidationMessage> messages = new ArrayList<>(); report.forEach((m) -> messages.add(new ValidationMessage(m.getLogLevel().name(), m.toString()))); throw new ValidationException(dataPath, messages, null); } } catch (ProcessingException e) { throw new ValidationException(dataPath, emptyList(), e); } }
LogLevel logLevel = next.getLogLevel();
/** * Main dispatch method * * <p>All messages logged go through this method. According to the report * configuration, the message will either be ignored, logged or raise an * exception.</p> * * @param message the message to log * @throws ProcessingException the message's level and report configuration * require that an exception be thrown */ protected final void dispatch(final ProcessingMessage message) throws ProcessingException { final LogLevel level = message.getLogLevel(); if (level.compareTo(exceptionThreshold) >= 0) throw message.asException(); if (level.compareTo(currentLevel) > 0) currentLevel = level; if (level.compareTo(logLevel) >= 0) log(level, message); }
LogLevel logLevel = next.getLogLevel();
/** * Main dispatch method * * <p>All messages logged go through this method. According to the report * configuration, the message will either be ignored, logged or raise an * exception.</p> * * @param message the message to log * @throws ProcessingException the message's level and report configuration * require that an exception be thrown */ protected final void dispatch(final ProcessingMessage message) throws ProcessingException { final LogLevel level = message.getLogLevel(); if (level.compareTo(exceptionThreshold) >= 0) throw message.asException(); if (level.compareTo(currentLevel) > 0) currentLevel = level; if (level.compareTo(logLevel) >= 0) log(level, message); }
/** * Main dispatch method * * All messages logged go through this method. According to the report * configuration, the message will either be ignored, logged or raise an * exception. * * @param message the message to log * @throws ProcessingException the message's level and report configuration * require that an exception be thrown */ private void dispatch(final ProcessingMessage message) throws ProcessingException { final LogLevel level = message.getLogLevel(); if (level.compareTo(exceptionThreshold) >= 0) throw message.asException(); if (level.compareTo(currentLevel) > 0) currentLevel = level; if (level.compareTo(logLevel) >= 0) log(message); }
/** * Main dispatch method * * <p>All messages logged go through this method. According to the report * configuration, the message will either be ignored, logged or raise an * exception.</p> * * @param message the message to log * @throws ProcessingException the message's level and report configuration * require that an exception be thrown */ protected final void dispatch(final ProcessingMessage message) throws ProcessingException { final LogLevel level = message.getLogLevel(); if (level.compareTo(exceptionThreshold) >= 0) throw message.asException(); if (level.compareTo(currentLevel) > 0) currentLevel = level; if (level.compareTo(logLevel) >= 0) log(level, message); }
public ProcessingMessageAssert hasLevel(final LogLevel level) { assertThat(level).isEqualTo(actual.getLogLevel()); return hasField("level", level); }
if (processingMessage.getLogLevel() != LogLevel.WARNING) { log.error(JacksonUtils.prettyPrint(processingMessage.asJson())); if (processingMessage.getLogLevel() != LogLevel.WARNING) { log.error(JacksonUtils.prettyPrint(processingMessage.asJson()));