You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "Cannot happen" happens often enough in actual use when the user passes in a bad value for the definition pointer.
For example one without a leading "/".
The code should deal with use input more conveniently by making some up front sanit checks perhaps, or at the very least don't just squash the JSONPointerException that comes from Jackson code as exception squashing is pure evil (if you don't mind me sayting so).
I'm trying to use this in a validator where folk provide a configurator and this kind of error handling means I have to check things up front where this library or it's transitive shoujld be doing it elegantly (nice error messages) instead.
public JsonSchema getJsonSchema(final JsonNode schema, final String ptr)
throws ProcessingException
{
BUNDLE.checkNotNull(schema, "nullSchema");
CORE_BUNDLE.checkNotNull(ptr, "nullPointer");
final JsonPointer pointer;
try {
pointer = new JsonPointer(ptr);
return validator.buildJsonSchema(schema, pointer);
} catch (JsonPointerException ignored) {
// Cannot happen
}
throw new IllegalStateException("How did I get there??");
}
The text was updated successfully, but these errors were encountered:
json-schema-validator/src/main/java/com/github/fge/jsonschema/main/JsonSchemaFactory.java
Line 207 in d265c6b
The "Cannot happen" happens often enough in actual use when the user passes in a bad value for the definition pointer.
For example one without a leading "/".
The code should deal with use input more conveniently by making some up front sanit checks perhaps, or at the very least don't just squash the JSONPointerException that comes from Jackson code as exception squashing is pure evil (if you don't mind me sayting so).
I'm trying to use this in a validator where folk provide a configurator and this kind of error handling means I have to check things up front where this library or it's transitive shoujld be doing it elegantly (nice error messages) instead.
The text was updated successfully, but these errors were encountered: