JacksonException (Jackson-core 2.14.0 API)

com.fasterxml.jackson.core

## Class JacksonException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.io.IOException
      - - com.fasterxml.jackson.core.JacksonException

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    JsonProcessingException

      public abstract class JacksonException
      extends IOException

  Base class for all Jackson-produced checked exceptions.

  For Jackson 2.x this base type is not widely used (instead, its main subtype `JsonProcessingException` is): it is provided more for forwards-compatibility purposes as 3.x will base all other types directly on it and deprecate `JsonProcessingException` (as well as chance its type to unchecked).

  Since:
    2.12
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JacksonException(String msg)`
    `protected` | `JacksonException(String msg, Throwable rootCause)`
    `protected` | `JacksonException(Throwable t)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract JsonLocation` | `getLocation()` Accessor for location information related to position within input or output (depending on operation), if available; if not available may return `null`.
    `abstract String` | `getOriginalMessage()` Method that allows accessing the original "message" argument, without additional decorations (like location information) that overridden `Throwable.getMessage()` adds.
    `abstract Object` | `getProcessor()` Method that allows accessing underlying processor that triggered this exception; typically either `JsonParser` or `JsonGenerator` for exceptions that originate from streaming API, but may be other types when thrown by databinding.

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### JacksonException

          protected JacksonException(String msg)

    - #### JacksonException

          protected JacksonException(Throwable t)

    - #### JacksonException

          protected JacksonException(String msg,
                                     Throwable rootCause)

  - ### Method Detail

    - #### getLocation

          public abstract JsonLocation getLocation()

      Accessor for location information related to position within input or output (depending on operation), if available; if not available may return `null`.

      Accuracy of location information depends on backend (format) as well as (in some cases) operation being performed.

      Returns:
        Location in input or output that triggered the problem reported, if available; `null` otherwise.

    - #### getOriginalMessage

          public abstract String getOriginalMessage()

      Method that allows accessing the original "message" argument, without additional decorations (like location information) that overridden `Throwable.getMessage()` adds.
      Returns:
        Original, unmodified `message` argument used to construct this exception instance

    - #### getProcessor

          public abstract Object getProcessor()

      Method that allows accessing underlying processor that triggered this exception; typically either `JsonParser` or `JsonGenerator` for exceptions that originate from streaming API, but may be other types when thrown by databinding.

      Note that it is possible that `null` may be returned if code throwing exception either has no access to the processor; or has not been retrofitted to set it; this means that caller needs to take care to check for nulls. Subtypes override this method with co-variant return type, for more type-safe access.

      Returns:
        Originating processor, if available; `null` if not.

Copyright © 2008–2022 FasterXML. All rights reserved.