Class JsonPointerEvaluationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.flipkart.zjsonpatch.JsonPointerEvaluationException
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJsonPointerEvaluationException(String message, AbstractJsonPointer path, JsonNodeWrapper target) JsonPointerEvaluationException(String message, Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptiongetPath()Returns the JSON pointer path that caused the evaluation failure.<NODE> NODEReturns the target node where the JSON pointer evaluation failed.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
JsonPointerEvaluationException
public JsonPointerEvaluationException(String message, AbstractJsonPointer path, JsonNodeWrapper target) -
JsonPointerEvaluationException
-
-
Method Details
-
getPath
Returns the JSON pointer path that caused the evaluation failure. This method returns the appropriate pointer type based on context:JsonPointerwhen using Jackson 2.x APIs (JsonDiff, JsonPatch, etc.)Jackson3JsonPointerwhen using Jackson 3.x APIs (Jackson3JsonDiff, etc.)
Example usage:
try { pointer.evaluate(node); } catch (JsonPointerEvaluationException e) { AbstractJsonPointer path = e.getPath(); // Works with both Jackson 2.x and 3.x System.out.println("Failed at: " + path); }Breaking Change in 0.6.0: This method now returns
AbstractJsonPointerinstead ofJsonPointer. Code that previously declaredJsonPointer path = e.getPath();must be updated to useAbstractJsonPointer path = e.getPath();. This change enables support for both Jackson 2.x and 3.x without requiring both versions on the classpath.- Returns:
- the JSON pointer path where evaluation failed, or null
-
getTarget
public <NODE> NODE getTarget()Returns the target node where the JSON pointer evaluation failed.This method returns the underlying native Jackson node type (Jackson 2.x or 3.x) based on the node involved in the failed evaluation. In environments where both Jackson 2 and 3 are present, callers must not assume a particular JsonNode type; expecting the wrong type may result in
ClassCastException.- Type Parameters:
NODE- the expected Jackson JsonNode type- Returns:
- the target JsonNode in its original Jackson version, or null
-