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
In jackson-core-2.9.3, NodeType.getNodeType fails the Preconditions check with a NullPointerException if the JsonToken is not in the TOKEN_MAP:
/**
* Given a {@link JsonNode} as an argument, return its type. The argument
* MUST NOT BE NULL, and MUST NOT be a {@link MissingNode}
*
* @param node the node to determine the type of
* @return the type for this node
*/
public static NodeType getNodeType(final JsonNode node)
{
final JsonToken token = node.asToken();
final NodeType ret = TOKEN_MAP.get(token);
Preconditions.checkNotNull(ret, "unhandled token type " + token);
return ret;
}
Here is a simple unit test I wrote to test the different versions of jackson-core.
In version 2.6.4 of jackson-core, this would fail with a JsonMappingException. However, in version 2.9.3 of jackson-core, this will trigger a NPE. Here is the stacktrace:
com.delphix.appliance.node.logging.exception.ConstructingFatalThrowableException: java.lang.NullPointerException: unhandled token type NOT_AVAILABLE
at com.delphix.appliance.server.util.ExceptionInstrumentationUtil.handleFatalThrowable(ExceptionInstrumentationUtil.java:193)
at com.delphix.appliance.server.util.ExceptionInstrumentationUtil.access$000(ExceptionInstrumentationUtil.java:32)
at com.delphix.appliance.server.util.ExceptionInstrumentationUtil$2.sample(ExceptionInstrumentationUtil.java:163)
at com.delphix.appliance.server.util.ExceptionInstrumentationUtil$2.sample(ExceptionInstrumentationUtil.java:159)
at com.google.monitoring.runtime.instrumentation.ConstructorInstrumenter.invokeSamplers(ConstructorInstrumenter.java:207)
at java.lang.RuntimeException.<init>(RuntimeException.java:63)
at java.lang.NullPointerException.<init>(NullPointerException.java:70)
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:787)
at com.github.fge.jackson.NodeType.getNodeType(NodeType.java:144)
at com.github.fge.jsonschema.processors.data.SchemaContext.<init>(SchemaContext.java:49)
at com.github.fge.jsonschema.processors.validation.InstanceValidator.process(InstanceValidator.java:104)
at com.github.fge.jsonschema.processors.validation.ValidationProcessor.process(ValidationProcessor.java:56)
at com.github.fge.jsonschema.processors.validation.ValidationProcessor.process(ValidationProcessor.java:34)
at com.github.fge.jsonschema.core.processing.ProcessingResult.of(ProcessingResult.java:79)
at com.github.fge.jsonschema.main.JsonSchema.doValidate(JsonSchema.java:76)
at com.github.fge.jsonschema.main.JsonSchema.validInstance(JsonSchema.java:182)
The text was updated successfully, but these errors were encountered:
In jackson-core-2.9.3,
NodeType.getNodeType
fails the Preconditions check with a NullPointerException if the JsonToken is not in theTOKEN_MAP
:Here is a simple unit test I wrote to test the different versions of jackson-core.
In version 2.6.4 of jackson-core, this would fail with a
JsonMappingException
. However, in version 2.9.3 of jackson-core, this will trigger a NPE. Here is the stacktrace:The text was updated successfully, but these errors were encountered: