Search in sources :

Example 1 with JSONDecodingException

use of org.n52.svalbard.decode.json.JSONDecodingException in project arctic-sea by 52North.

the class JSONValidator method validateAndThrow.

public void validateAndThrow(JsonNode instance, String schema) throws DecodingException {
    ProcessingReport report = JSONValidator.getInstance().validate(instance, schema);
    if (!report.isSuccess()) {
        String message = encode(report, instance);
        LOG.info("Invalid JSON instance:\n{}", message);
        throw new JSONDecodingException(message);
    }
}
Also used : ProcessingReport(com.github.fge.jsonschema.core.report.ProcessingReport) JSONDecodingException(org.n52.svalbard.decode.json.JSONDecodingException)

Aggregations

ProcessingReport (com.github.fge.jsonschema.core.report.ProcessingReport)1 JSONDecodingException (org.n52.svalbard.decode.json.JSONDecodingException)1