Package org.codehaus.jackson.map
Class JsonMappingException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- org.codehaus.jackson.JsonProcessingException
-
- org.codehaus.jackson.map.JsonMappingException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
UnrecognizedPropertyException
public class JsonMappingException extends JsonProcessingException
Checked exception used to signal fatal problems with mapping of content.One additional feature is the ability to denote relevant path of references (during serialization/deserialization) to help in troubleshooting.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJsonMappingException.ReferenceSimple bean class used to contain references.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.LinkedList<JsonMappingException.Reference>_pathPath through which problem that triggering throwing of this exception was reached.-
Fields inherited from class org.codehaus.jackson.JsonProcessingException
mLocation
-
-
Constructor Summary
Constructors Constructor Description JsonMappingException(java.lang.String msg)JsonMappingException(java.lang.String msg, java.lang.Throwable rootCause)JsonMappingException(java.lang.String msg, JsonLocation loc)JsonMappingException(java.lang.String msg, JsonLocation loc, java.lang.Throwable rootCause)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_appendPathDesc(java.lang.StringBuilder sb)static JsonMappingExceptionfrom(JsonParser jp, java.lang.String msg)static JsonMappingExceptionfrom(JsonParser jp, java.lang.String msg, java.lang.Throwable problem)java.lang.StringgetMessage()Method is overridden so that we can properly inject description of problem path, if such is defined.java.util.List<JsonMappingException.Reference>getPath()voidprependPath(java.lang.Object referrer, int index)Method called to prepend a reference information in front of current pathvoidprependPath(java.lang.Object referrer, java.lang.String fieldName)Method called to prepend a reference information in front of current pathvoidprependPath(JsonMappingException.Reference r)java.lang.StringtoString()static JsonMappingExceptionwrapWithPath(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 JsonMappingExceptionwrapWithPath(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.static JsonMappingExceptionwrapWithPath(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.-
Methods inherited from class org.codehaus.jackson.JsonProcessingException
getLocation
-
-
-
-
Field Detail
-
_path
protected java.util.LinkedList<JsonMappingException.Reference> _path
Path through which problem that triggering throwing of this exception was reached.
-
-
Constructor Detail
-
JsonMappingException
public JsonMappingException(java.lang.String msg)
-
JsonMappingException
public JsonMappingException(java.lang.String msg, java.lang.Throwable rootCause)
-
JsonMappingException
public JsonMappingException(java.lang.String msg, JsonLocation loc)
-
JsonMappingException
public JsonMappingException(java.lang.String msg, JsonLocation loc, java.lang.Throwable rootCause)
-
-
Method Detail
-
from
public static JsonMappingException from(JsonParser jp, java.lang.String msg)
-
from
public static JsonMappingException from(JsonParser jp, java.lang.String msg, java.lang.Throwable problem)
-
wrapWithPath
public 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. This version of method is called when the reference is through a non-indexed object, such as a Map or POJO/bean.
-
wrapWithPath
public 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. This version of method is called when the reference is through an index, which happens with arrays and Collections.
-
wrapWithPath
public 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.
-
getPath
public java.util.List<JsonMappingException.Reference> getPath()
-
prependPath
public void prependPath(java.lang.Object referrer, java.lang.String fieldName)Method called to prepend a reference information in front of current path
-
prependPath
public void prependPath(java.lang.Object referrer, int index)Method called to prepend a reference information in front of current path
-
prependPath
public void prependPath(JsonMappingException.Reference r)
-
getMessage
public java.lang.String getMessage()
Method is overridden so that we can properly inject description of problem path, if such is defined.- Overrides:
getMessagein classJsonProcessingException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classJsonProcessingException
-
_appendPathDesc
protected void _appendPathDesc(java.lang.StringBuilder sb)
-
-