Package com.fasterxml.jackson.jr.ob
Class JSONObjectException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- com.fasterxml.jackson.core.JacksonException
-
- com.fasterxml.jackson.core.JsonProcessingException
-
- com.fasterxml.jackson.jr.ob.JSONObjectException
-
- All Implemented Interfaces:
java.io.Serializable
public class JSONObjectException extends com.fasterxml.jackson.core.JsonProcessingException
Standard exception exposed by this package; equivalent ofcom.fasterxml.jackson.databind.JsonMappingException
(and, in fact, much of implementation came from that class, but had to be cut-n-pasted since we do not depend on databind package).- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JSONObjectException.Reference
Simple bean class used to contain references.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.LinkedList<JSONObjectException.Reference>
_path
Path through which problem that triggering throwing of this exception was reached.
-
Constructor Summary
Constructors Constructor Description JSONObjectException(java.lang.String msg)
JSONObjectException(java.lang.String msg, com.fasterxml.jackson.core.JsonLocation loc)
JSONObjectException(java.lang.String msg, com.fasterxml.jackson.core.JsonLocation loc, java.lang.Throwable rootCause)
JSONObjectException(java.lang.String msg, 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)
protected java.lang.String
_buildMessage()
static JSONObjectException
from(com.fasterxml.jackson.core.JsonParser p, java.lang.String msg)
static JSONObjectException
from(com.fasterxml.jackson.core.JsonParser p, java.lang.String msg, java.lang.Object... args)
static JSONObjectException
from(com.fasterxml.jackson.core.JsonParser p, java.lang.Throwable problem, java.lang.String msg, java.lang.Object... args)
static JSONObjectException
fromUnexpectedIOE(java.io.IOException src)
Factory method used when "upgrading" anIOException
intoJSONObjectException
: 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<JSONObjectException.Reference>
getPath()
Method for accessing full structural path within type hierarchy down to problematic property.java.lang.String
getPathReference()
Method for accesing description of path that lead to the problem that triggered this exceptionjava.lang.StringBuilder
getPathReference(java.lang.StringBuilder sb)
void
prependPath(JSONObjectException.Reference r)
void
prependPath(java.lang.Object referrer, int index)
Method called to prepend a reference information in front of current pathvoid
prependPath(java.lang.Object referrer, java.lang.String fieldName)
Method called to prepend a reference information in front of current pathjava.lang.String
toString()
static JSONObjectException
wrapWithPath(java.lang.Throwable src, JSONObjectException.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 JSONObjectException
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 JSONObjectException
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.-
Methods inherited from class com.fasterxml.jackson.core.JsonProcessingException
clearLocation, getLocation, getMessageSuffix, getOriginalMessage, getProcessor
-
-
-
-
Field Detail
-
_path
protected java.util.LinkedList<JSONObjectException.Reference> _path
Path through which problem that triggering throwing of this exception was reached.
-
-
Constructor Detail
-
JSONObjectException
public JSONObjectException(java.lang.String msg)
-
JSONObjectException
public JSONObjectException(java.lang.String msg, java.lang.Throwable rootCause)
-
JSONObjectException
public JSONObjectException(java.lang.String msg, com.fasterxml.jackson.core.JsonLocation loc)
-
JSONObjectException
public JSONObjectException(java.lang.String msg, com.fasterxml.jackson.core.JsonLocation loc, java.lang.Throwable rootCause)
-
-
Method Detail
-
from
public static JSONObjectException from(com.fasterxml.jackson.core.JsonParser p, java.lang.String msg)
-
from
public static JSONObjectException from(com.fasterxml.jackson.core.JsonParser p, java.lang.String msg, java.lang.Object... args)
-
from
public static JSONObjectException from(com.fasterxml.jackson.core.JsonParser p, java.lang.Throwable problem, java.lang.String msg, java.lang.Object... args)
-
fromUnexpectedIOE
public static JSONObjectException fromUnexpectedIOE(java.io.IOException src)
Factory method used when "upgrading" anIOException
intoJSONObjectException
: usually only needed to comply with a signature.
-
wrapWithPath
public static JSONObjectException 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 JSONObjectException 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 JSONObjectException wrapWithPath(java.lang.Throwable src, JSONObjectException.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<JSONObjectException.Reference> getPath()
Method for accessing full structural path within type hierarchy down to problematic property.
-
getPathReference
public java.lang.String getPathReference()
Method for accesing description of path that lead to the problem that triggered this exception
-
getPathReference
public java.lang.StringBuilder getPathReference(java.lang.StringBuilder sb)
-
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(JSONObjectException.Reference r)
-
getLocalizedMessage
public java.lang.String getLocalizedMessage()
- Overrides:
getLocalizedMessage
in classjava.lang.Throwable
-
getMessage
public java.lang.String getMessage()
Method is overridden so that we can properly inject description of problem path, if such is defined.- Overrides:
getMessage
in classcom.fasterxml.jackson.core.JsonProcessingException
-
_buildMessage
protected java.lang.String _buildMessage()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classcom.fasterxml.jackson.core.JsonProcessingException
-
_appendPathDesc
protected void _appendPathDesc(java.lang.StringBuilder sb)
-
-