public class JsonMappingException extends JsonProcessingException
IOException
s) or data encoding/decoding
problems (signaled with JsonParseException
,
JsonGenerationException
).
One additional feature is the ability to denote relevant path of references (during serialization/deserialization) to help in troubleshooting.
Modifier and Type | Class and Description |
---|---|
static class |
JsonMappingException.Reference
Simple bean class used to contain references.
|
Constructor and Description |
---|
JsonMappingException(java.io.Closeable processor,
java.lang.String msg) |
JsonMappingException(java.io.Closeable processor,
java.lang.String msg,
JsonLocation loc) |
JsonMappingException(java.io.Closeable processor,
java.lang.String msg,
java.lang.Throwable problem) |
JsonMappingException(java.lang.String msg)
Deprecated.
Since 2.7 Use variant that takes
JsonParser instead |
JsonMappingException(java.lang.String msg,
JsonLocation loc)
Deprecated.
Since 2.7 Use variant that takes
JsonParser instead |
JsonMappingException(java.lang.String msg,
JsonLocation loc,
java.lang.Throwable rootCause)
Deprecated.
Since 2.7 Use variant that takes
JsonParser instead |
JsonMappingException(java.lang.String msg,
java.lang.Throwable rootCause)
Deprecated.
Since 2.7 Use variant that takes
JsonParser instead |
Modifier and Type | Method and Description |
---|---|
static JsonMappingException |
from(DeserializationContext ctxt,
java.lang.String msg) |
static JsonMappingException |
from(DeserializationContext ctxt,
java.lang.String msg,
java.lang.Throwable t) |
static JsonMappingException |
from(JsonGenerator g,
java.lang.String msg) |
static JsonMappingException |
from(JsonGenerator g,
java.lang.String msg,
java.lang.Throwable problem) |
static JsonMappingException |
from(JsonParser p,
java.lang.String msg) |
static JsonMappingException |
from(JsonParser p,
java.lang.String msg,
java.lang.Throwable problem) |
static JsonMappingException |
from(SerializerProvider ctxt,
java.lang.String msg) |
static JsonMappingException |
from(SerializerProvider ctxt,
java.lang.String msg,
java.lang.Throwable problem) |
static JsonMappingException |
fromUnexpectedIOE(java.io.IOException src)
Factory method used when "upgrading" an
IOException into
JsonMappingException : usually only needed to comply with
a signature. |
java.lang.String |
getLocalizedMessage() |
java.lang.String |
getMessage()
Method is overridden so that we can properly inject description
of problem path, if such is defined.
|
java.util.List<JsonMappingException.Reference> |
getPath()
Method for accessing full structural path within type hierarchy
down to problematic property.
|
java.lang.String |
getPathReference()
Method for accessing description of path that lead to the
problem that triggered this exception
|
java.lang.StringBuilder |
getPathReference(java.lang.StringBuilder sb) |
java.lang.Object |
getProcessor()
Method that allows accessing underlying processor that triggered
this exception; typically either
JsonParser or JsonGenerator
for exceptions that originate from streaming API. |
void |
prependPath(JsonMappingException.Reference r) |
void |
prependPath(java.lang.Object referrer,
int index)
Method called to prepend a reference information in front of
current path
|
void |
prependPath(java.lang.Object referrer,
java.lang.String fieldName)
Method called to prepend a reference information in front of
current path
|
java.lang.String |
toString() |
static JsonMappingException |
wrapWithPath(java.lang.Throwable src,
JsonMappingException.Reference ref)
Method that can be called to either create a new JsonMappingException
(if underlying exception is not a JsonMappingException), or augment
given exception with given path/reference information.
|
static JsonMappingException |
wrapWithPath(java.lang.Throwable src,
java.lang.Object refFrom,
int index)
Method that can be called to either create a new JsonMappingException
(if underlying exception is not a JsonMappingException), or augment
given exception with given path/reference information.
|
static JsonMappingException |
wrapWithPath(java.lang.Throwable src,
java.lang.Object refFrom,
java.lang.String refFieldName)
Method that can be called to either create a new JsonMappingException
(if underlying exception is not a JsonMappingException), or augment
given exception with given path/reference information.
|
clearLocation, getLocation, getOriginalMessage
@Deprecated public JsonMappingException(java.lang.String msg)
JsonParser
instead@Deprecated public JsonMappingException(java.lang.String msg, java.lang.Throwable rootCause)
JsonParser
instead@Deprecated public JsonMappingException(java.lang.String msg, JsonLocation loc)
JsonParser
instead@Deprecated public JsonMappingException(java.lang.String msg, JsonLocation loc, java.lang.Throwable rootCause)
JsonParser
insteadpublic JsonMappingException(java.io.Closeable processor, java.lang.String msg)
public JsonMappingException(java.io.Closeable processor, java.lang.String msg, java.lang.Throwable problem)
public JsonMappingException(java.io.Closeable processor, java.lang.String msg, JsonLocation loc)
public static JsonMappingException from(JsonParser p, java.lang.String msg)
public static JsonMappingException from(JsonParser p, java.lang.String msg, java.lang.Throwable problem)
public static JsonMappingException from(JsonGenerator g, java.lang.String msg)
public static JsonMappingException from(JsonGenerator g, java.lang.String msg, java.lang.Throwable problem)
public static JsonMappingException from(DeserializationContext ctxt, java.lang.String msg)
public static JsonMappingException from(DeserializationContext ctxt, java.lang.String msg, java.lang.Throwable t)
public static JsonMappingException from(SerializerProvider ctxt, java.lang.String msg)
public static JsonMappingException from(SerializerProvider ctxt, java.lang.String msg, java.lang.Throwable problem)
public static JsonMappingException fromUnexpectedIOE(java.io.IOException src)
IOException
into
JsonMappingException
: usually only needed to comply with
a signature.
NOTE: since 2.9 should usually NOT be used on input-side (deserialization)
exceptions; instead use method(s) of InputMismatchException
public static JsonMappingException wrapWithPath(java.lang.Throwable src, java.lang.Object refFrom, java.lang.String refFieldName)
public static JsonMappingException wrapWithPath(java.lang.Throwable src, java.lang.Object refFrom, int index)
public static JsonMappingException wrapWithPath(java.lang.Throwable src, JsonMappingException.Reference ref)
public java.util.List<JsonMappingException.Reference> getPath()
public java.lang.String getPathReference()
public java.lang.StringBuilder getPathReference(java.lang.StringBuilder sb)
public void prependPath(java.lang.Object referrer, java.lang.String fieldName)
public void prependPath(java.lang.Object referrer, int index)
public void prependPath(JsonMappingException.Reference r)
public java.lang.Object getProcessor()
JsonProcessingException
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.getProcessor
in class JsonProcessingException
public java.lang.String getLocalizedMessage()
getLocalizedMessage
in class java.lang.Throwable
public java.lang.String getMessage()
getMessage
in class JsonProcessingException
public java.lang.String toString()
toString
in class JsonProcessingException
Copyright © 2010 - 2020 Adobe. All Rights Reserved