java-json-tools / jackson-coreutils

JSON Pointer (RFC 6901) and numeric JSON equivalence for Jackson (2.2.x)
Other
5 stars 6 forks source link

Handle BinaryNode in NodeType #56

Open DanielGronau opened 4 years ago

DanielGronau commented 4 years ago

Given a JSON tree containing a BinaryNode, validating it with json-schema-validator will cause a NPE:

 java.lang.NullPointerException: unhandled token type VALUE_EMBEDDED_OBJECT

The underlying issue is that while Jackson will serialize and deserialize the binary value to and from a (base64 encoded) string, the BinaryNode.asToken method returns VALUE_EMBEDDED_OBJECT. This token type is not listed in NodeType.TOKEN_MAP, causing the mentioned NPE. Adding a mapping from VALUE_EMBEDDED_OBJECT to STRING would solve the problem.