java.io.IOException s) or data encoding/decoding
problems (signaled with com.fasterxml.jackson.core.exc.StreamReadException ,
com.fasterxml.jackson.core.exc.StreamWriteException ).
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 |
|---|---|
| public static class | JsonMappingException.
Simple bean class used to contain references. |
| Modifier and Type | Field and Description |
|---|---|
| protected LinkedList | _path
Path through which problem that triggering throwing of this exception was reached. |
| protected transient Closeable | _processor
Underlying processor ( |
| pack-priv static final int | MAX_REFS_TO_LIST
Let's limit length of reference chain, to limit damage in cases of infinite recursion. |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | JsonMappingException(String msg, Throwable rootCause)
Deprecated
Since 2.7 Use variant that takes
JsonParser instead
|
| public | JsonMappingException(String msg, JsonLocation loc)
Deprecated
Since 2.7 Use variant that takes
JsonParser instead
|
| public | JsonMappingException(String msg, JsonLocation loc, Throwable rootCause)
Deprecated
Since 2.7 Use variant that takes
JsonParser instead
|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected StringBuilder | _appendReferenceChain(StringBuilder sb)
Method that is called to add reference chain information to message, but may be overridden to customize handling, including appending other information or removing the reference chain altogether. |
| protected String | |
| private static JsonGenerator | |
| private static JsonParser | |
| public static JsonMappingException | |
| public static JsonMappingException | |
| public static JsonMappingException | |
| public static JsonMappingException | |
| public static JsonMappingException | |
| public static JsonMappingException | |
| public static JsonMappingException | |
| public static JsonMappingException | |
| public static JsonMappingException | fromUnexpectedIOE(IOException src)
Factory method used when "upgrading" an |
| public String | getLocalizedMessage()
Overrides java. Creates a localized description of this throwable. |
| public String | getMessage()
Overrides com. Method is overridden so that we can properly inject description of problem path, if such is defined. |
| public List | getPath()
Method for accessing full structural path within type hierarchy down to problematic property. |
| public String | getPathReference()
Method for accessing description of path that lead to the problem that triggered this exception |
| public StringBuilder | |
| public Object | getProcessor()
Overrides com. Method that allows accessing underlying processor that triggered
this exception; typically either |
| public void | prependPath(Object referrer, String fieldName)
Implements abstract com. Method called to prepend a reference information in front of current path |
| public void | prependPath(Object referrer, int index)
Implements abstract com. Method called to prepend a reference information in front of current path |
| public void | |
| public String | toString()
Overrides com. Returns a short description of this throwable. |
| public JsonMappingException | |
| public static JsonMappingException | wrapWithPath(Throwable src, Object refFrom, 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. |
| public static JsonMappingException | wrapWithPath(Throwable src, 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. |
| public static JsonMappingException | wrapWithPath(Throwable src, JsonMappingException.
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. |
| _path | back to summary |
|---|---|
| protected LinkedList<JsonMappingException. Path through which problem that triggering throwing of this exception was reached. | |
| _processor | back to summary |
|---|---|
| protected transient Closeable _processor Underlying processor ( Note typically not serializable hence
| |
| MAX_REFS_TO_LIST | back to summary |
|---|---|
| pack-priv static final int MAX_REFS_TO_LIST Let's limit length of reference chain, to limit damage in cases of infinite recursion. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides com. | |
| JsonMappingException | back to summary |
|---|---|
| public JsonMappingException(String msg)
Deprecated Since 2.7 Use variant that takes
| |
| JsonMappingException | back to summary |
|---|---|
| public JsonMappingException(String msg, Throwable rootCause)
Deprecated Since 2.7 Use variant that takes
| |
| JsonMappingException | back to summary |
|---|---|
| public JsonMappingException(String msg, JsonLocation loc)
Deprecated Since 2.7 Use variant that takes
| |
| JsonMappingException | back to summary |
|---|---|
| public JsonMappingException(String msg, JsonLocation loc, Throwable rootCause)
Deprecated Since 2.7 Use variant that takes
| |
| JsonMappingException | back to summary |
|---|---|
public JsonMappingException(Closeable processor, String msg)
| |
| JsonMappingException | back to summary |
|---|---|
public JsonMappingException(Closeable processor, String msg, Throwable problem)
| |
| JsonMappingException | back to summary |
|---|---|
public JsonMappingException(Closeable processor, String msg, JsonLocation loc)
| |
| _appendPathDesc | back to summary |
|---|---|
| protected void _appendPathDesc(StringBuilder sb) | |
| _appendReferenceChain | back to summary |
|---|---|
| protected StringBuilder _appendReferenceChain(StringBuilder sb) Method that is called to add reference chain information to message, but may be overridden to customize handling, including appending other information or removing the reference chain altogether.
| |
| _buildMessage | back to summary |
|---|---|
| protected String _buildMessage() | |
| _generator | back to summary |
|---|---|
| private static JsonGenerator _generator(SerializerProvider ctxt) | |
| _parser | back to summary |
|---|---|
| private static JsonParser _parser(DeserializationContext ctxt) | |
| from | back to summary |
|---|---|
public static JsonMappingException from(JsonParser p, String msg)
| |
| from | back to summary |
|---|---|
public static JsonMappingException from(JsonParser p, String msg, Throwable problem)
| |
| from | back to summary |
|---|---|
public static JsonMappingException from(JsonGenerator g, String msg)
| |
| from | back to summary |
|---|---|
public static JsonMappingException from(JsonGenerator g, String msg, Throwable problem)
| |
| from | back to summary |
|---|---|
public static JsonMappingException from(DeserializationContext ctxt, String msg)
| |
| from | back to summary |
|---|---|
public static JsonMappingException from(DeserializationContext ctxt, String msg, Throwable t)
| |
| from | back to summary |
|---|---|
public static JsonMappingException from(SerializerProvider ctxt, String msg)
| |
| from | back to summary |
|---|---|
public static JsonMappingException from(SerializerProvider ctxt, String msg, Throwable problem)
| |
| fromUnexpectedIOE | back to summary |
|---|---|
| public static JsonMappingException fromUnexpectedIOE(IOException src) Factory method used when "upgrading" an Note since 2.9 should usually NOT be used on input-side (deserialization)
exceptions; instead use method(s) of
| |
| getLocalizedMessage | back to summary |
|---|---|
| public String getLocalizedMessage() Overrides java. Doc from java. Creates a localized description of this throwable.
Subclasses may override this method in order to produce a
locale-specific message. For subclasses that do not override this
method, the default implementation returns the same result as
| |
| getMessage | back to summary |
|---|---|
| public String getMessage() Overrides com. Method is overridden so that we can properly inject description of problem path, if such is defined.
| |
| getPath | back to summary |
|---|---|
| public List Method for accessing full structural path within type hierarchy down to problematic property. | |
| getPathReference | back to summary |
|---|---|
| public String getPathReference() Method for accessing description of path that lead to the problem that triggered this exception | |
| getPathReference | back to summary |
|---|---|
| public StringBuilder getPathReference(StringBuilder sb) | |
| getProcessor | back to summary |
|---|---|
| public Object getProcessor() Overrides com. Doc from com. Method that allows accessing underlying processor that triggered
this exception; typically either
| |
| prependPath | back to summary |
|---|---|
| public void prependPath(Object referrer, String fieldName) Implements abstract com. Method called to prepend a reference information in front of current path
| |
| prependPath | back to summary |
|---|---|
| public void prependPath(Object referrer, int index) Implements abstract com. Method called to prepend a reference information in front of current path
| |
| prependPath | back to summary |
|---|---|
| public void prependPath(JsonMappingException. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides com. Doc from java. Returns a short description of this throwable. The result is the concatenation of:
getLocalizedMessage returns null, then just
the class name is returned.
| |
| withCause | back to summary |
|---|---|
public JsonMappingException withCause(Throwable cause)
| |
| wrapWithPath | back to summary |
|---|---|
| public static JsonMappingException wrapWithPath(Throwable src, Object refFrom, 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. This version of method is called when the reference is through a non-indexed object, such as a Map or POJO/bean. | |
| wrapWithPath | back to summary |
|---|---|
| public static JsonMappingException wrapWithPath(Throwable src, 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. This version of method is called when the reference is through an index, which happens with arrays and Collections. | |
| wrapWithPath | back to summary |
|---|---|
| public static JsonMappingException wrapWithPath(Throwable src, JsonMappingException. 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.
| |
| Modifier and Type | Field and Description |
|---|---|
| protected String | |
| protected String | _fieldName
Name of field (for beans) or key (for Maps) that is part of the reference. |
| protected transient Object | |
| protected int | _index
Index within a |
| private static final long |
| Access | Constructor and Description |
|---|---|
| protected | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public String | |
| public Object | |
| public int | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public String | |
| pack-priv Object |
| _desc | back to summary |
|---|---|
| protected String _desc Lazily-constructed description of this instance; needed mostly to
allow JDK serialization to work in case where
| |
| _fieldName | back to summary |
|---|---|
| protected String _fieldName Name of field (for beans) or key (for Maps) that is part
of the reference. May be null for Collection types (which
generally have | |
| _from | back to summary |
|---|---|
| protected transient Object _from | |
| _index | back to summary |
|---|---|
| protected int _index Index within a | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| Reference | back to summary |
|---|---|
| protected Reference() Default constructor for deserialization/sub-classing purposes | |
| Reference | back to summary |
|---|---|
| public Reference(Object from) | |
| Reference | back to summary |
|---|---|
| public Reference(Object from, String fieldName) | |
| Reference | back to summary |
|---|---|
| public Reference(Object from, int index) | |
| getDescription | back to summary |
|---|---|
| public String getDescription() | |
| getFieldName | back to summary |
|---|---|
| public String getFieldName() | |
| getFrom | back to summary |
|---|---|
| public Object getFrom() Object through which reference was resolved. Can be either actual instance (usually the case for serialization), or Class (usually the case for deserialization). Note that this value must be `transient` to allow serializability (as often such Object is NOT serializable; or, in case of `Class`, may not available at the point of deserialization). As such will return `null` if instance has been passed using JDK serialization.
| |
| getIndex | back to summary |
|---|---|
| public int getIndex() | |
| setDescription | back to summary |
|---|---|
| pack-priv void setDescription(String d) | |
| setFieldName | back to summary |
|---|---|
| pack-priv void setFieldName(String n) | |
| setIndex | back to summary |
|---|---|
| pack-priv void setIndex(int ix) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| writeReplace | back to summary |
|---|---|
| pack-priv Object writeReplace() May need some cleaning here, given that `from` may or may not be serializable. since 2.8 | |