Top Description Fields Constructors Methods
com.fasterxml.jackson.core

public Class JsonProcessingException

extends JacksonException
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.core.exc.StreamConstraintsException, com.fasterxml.jackson.core.exc.StreamReadException, com.fasterxml.jackson.core.exc.StreamWriteException

Intermediate base class for all problems encountered when processing (parsing, generating) JSON content that are not pure I/O problems. Regular java.io.IOExceptions will be passed through as is. Sub-class of java.io.IOException for convenience.

Since Jackson 2.12 extends intermediate JacksonException type instead of directly extending java.io.IOException.

Since Jackson 2.16, handles its content as configured using com.fasterxml.jackson.core.ErrorReportConfiguration.

Field Summary

Modifier and TypeField and Description
protected JsonLocation
private static final long

Constructor Summary

AccessConstructor and Description
protected
protected
protected
protected
protected

Method Summary

Modifier and TypeMethod and Description
public void
clearLocation()

Method that allows to remove context information from this exception's message.

public JsonLocation
getLocation()

Implements abstract com.fasterxml.jackson.core.JacksonException.getLocation.

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

Returns:

Original message preceded by optional prefix and followed by location information, message and location information separated by a linefeed
getMessage
()

Overrides java.lang.Throwable.getMessage.

Default implementation overridden so that we can add location information
protected String

Returns:

Message suffix assigned, if any; null if none
getMessageSuffix
()

Accessor that sub-classes can override to append additional information right after the main message, but before source location information.

public String

Returns:

Original message passed in constructor
getOriginalMessage
()

Implements abstract com.fasterxml.jackson.core.JacksonException.getOriginalMessage.

Method that allows accessing the original "message" argument, without additional decorations (like location information) that overridden getMessage adds.
public Object

Returns:

Originating processor, if available; null if not.
getProcessor
()

Implements abstract com.fasterxml.jackson.core.JacksonException.getProcessor.

Method that allows accessing underlying processor that triggered this exception; typically either JsonParser or JsonGenerator for exceptions that originate from streaming API.
public String
toString()

Overrides java.lang.Throwable.toString.

Returns a short description of this throwable.

Field Detail

_locationback to summary
protected JsonLocation _location
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.core.JacksonException.serialVersionUID.

Constructor Detail

JsonProcessingExceptionback to summary
protected JsonProcessingException(String msg, JsonLocation loc, Throwable rootCause)
JsonProcessingExceptionback to summary
protected JsonProcessingException(String msg)
JsonProcessingExceptionback to summary
protected JsonProcessingException(String msg, JsonLocation loc)
JsonProcessingExceptionback to summary
protected JsonProcessingException(String msg, Throwable rootCause)
JsonProcessingExceptionback to summary
protected JsonProcessingException(Throwable rootCause)

Method Detail

clearLocationback to summary
public void clearLocation()

Method that allows to remove context information from this exception's message. Useful when you are parsing security-sensitive data and don't want original data excerpts to be present in Jackson parser error messages.

Since
2.9
getLocationback to summary
public JsonLocation getLocation()

Implements abstract com.fasterxml.jackson.core.JacksonException.getLocation.

Doc from com.fasterxml.jackson.core.JacksonException.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:JsonLocation

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

Annotations
@Override
getMessageback to summary
public String getMessage()

Overrides java.lang.Throwable.getMessage.

Default implementation overridden so that we can add location information

Returns:String

Original message preceded by optional prefix and followed by location information, message and location information separated by a linefeed

Annotations
@Override
getMessageSuffixback to summary
protected String getMessageSuffix()

Accessor that sub-classes can override to append additional information right after the main message, but before source location information.

Returns:String

Message suffix assigned, if any; null if none

getOriginalMessageback to summary
public String getOriginalMessage()

Implements abstract com.fasterxml.jackson.core.JacksonException.getOriginalMessage.

Method that allows accessing the original "message" argument, without additional decorations (like location information) that overridden getMessage adds.

Returns:String

Original message passed in constructor

Annotations
@Override
Since
2.1
getProcessorback to summary
public Object getProcessor()

Implements abstract com.fasterxml.jackson.core.JacksonException.getProcessor.

Method that allows accessing underlying processor that triggered this exception; typically either JsonParser or JsonGenerator for exceptions that originate from streaming API. Note that it is possible that `null` may be returned if code throwing exception either has no access to 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:Object

Originating processor, if available; null if not.

Annotations
@Override
Since
2.7
toStringback to summary
public String toString()

Overrides java.lang.Throwable.toString.

Doc from java.lang.Throwable.toString.

Returns a short description of this throwable. The result is the concatenation of:

  • the name of the class of this object
  • ": " (a colon and a space)
  • the result of invoking this object's getLocalizedMessage method
If getLocalizedMessage returns null, then just the class name is returned.
Returns:String

a string representation of this throwable.

Annotations
@Override