I have following checks on input json and schema. I use intelliJ and it's static code analysis is saying condition shcema != null is always true.
if (json == null && schema == null){
return;
}
if ((json == null && schema != null) || (json != null && schema == null)){
throw new InvalidRequestException("error message");
} else try {
JsonSchema jsonSchema = JsonSchemaFactory.byDefault().getJsonSchema(schema);
ProcessingReport processingReport = jsonSchema.validate(json);
...
} catch ( ... ) { ... }
Now, if i don't put in the first if condition where i am checking both objects, i might miss a use-case where its okay not to provide anything. Thats why i am using return in first if and not an exception.
What am i missing here
Aucun commentaire:
Enregistrer un commentaire