java-json-tools / json-schema-validator

A JSON Schema validation implementation in pure Java, which aims for correctness and performance, in that order
http://json-schema-validator.herokuapp.com/
Other
1.63k stars 400 forks source link

Getting NPE when passing null to validate method. #376

Open rahul22048 opened 3 years ago

rahul22048 commented 3 years ago

below is the code snippet:-

final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
final JsonNode node = JsonLoader.fromResource("/json-patch.json");
SCHEMA = factory.getJsonSchema(node);

in another method, i use it like this:-

ProcessingReport report = SCHEMA.validate(patchJson);

NPE exception comes when patchJson is passed as null.

for reference json-patch.json is same as the one here:- https://github.com/fge/json-schema-processor-examples/blob/master/src/main/resources/json-patch.json