Class JsonPointerEvaluationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.flipkart.zjsonpatch.JsonPointerEvaluationException
All Implemented Interfaces:
Serializable

public class JsonPointerEvaluationException extends Exception
See Also:
  • Constructor Details

  • Method Details

    • getPath

      public AbstractJsonPointer getPath()
      Returns the JSON pointer path that caused the evaluation failure. This method returns the appropriate pointer type based on context:

      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 AbstractJsonPointer instead of JsonPointer. Code that previously declared JsonPointer path = e.getPath(); must be updated to use AbstractJsonPointer 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