Class DeferredBindingException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
tools.jackson.core.JacksonException
tools.jackson.databind.DatabindException
tools.jackson.databind.exc.DeferredBindingException
All Implemented Interfaces:
Serializable

public class DeferredBindingException extends DatabindException
Exception that aggregates multiple recoverable deserialization problems encountered during problem-collecting mode.

Usage: This exception is thrown by ObjectReader.readValueCollectingProblems(...) when one or more recoverable problems were collected during deserialization. Enable problem collection via ObjectReader.problemCollectingReader().

Problem access: Each problem is captured as a CollectedProblem containing the JSON Pointer path, error message, location, target type, raw value, and token. Access problems via getProblems().

Limit handling: When the configured problem limit is reached, collection stops and isLimitReached() returns true. This indicates additional problems may exist beyond those collected.

Message formatting: The exception message shows:

  • For 1 problem: the single error message
  • For multiple: count + first 5 problems + "...and N more" suffix
  • A "limit reached" note if applicable

Example:


 try {
     MyBean bean = reader.problemCollectingReader()
                         .readValueCollectingProblems(json);
 } catch (DeferredBindingException e) {
     for (CollectedProblem p : e.getProblems()) {
         System.err.println("Error at " + p.getPath() + ": " + p.getMessage());
     }
 }
 
Since:
3.1
See Also:
  • Constructor Details

    • DeferredBindingException

      public DeferredBindingException(tools.jackson.core.JsonParser p, List<CollectedProblem> problems, boolean limitReached)
  • Method Details

    • getProblems

      public List<CollectedProblem> getProblems()
      Returns:
      Unmodifiable list of all collected problems
    • getProblemCount

      public int getProblemCount()
      Returns:
      Number of problems collected
    • isLimitReached

      public boolean isLimitReached()
      Returns:
      true if error collection stopped due to reaching the configured limit