com.fasterxml.jackson.databind

Class JsonMappingException

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    InvalidFormatException, PropertyBindingException


    public class JsonMappingException
    extends com.fasterxml.jackson.core.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
    • Constructor Detail

      • JsonMappingException

        public JsonMappingException(String msg)
      • JsonMappingException

        public JsonMappingException(String msg,
                            Throwable rootCause)
      • JsonMappingException

        public JsonMappingException(String msg,
                            com.fasterxml.jackson.core.JsonLocation loc)
      • JsonMappingException

        public JsonMappingException(String msg,
                            com.fasterxml.jackson.core.JsonLocation loc,
                            Throwable rootCause)
    • Method Detail

      • wrapWithPath

        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

        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

        public static JsonMappingException wrapWithPath(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.
      • getPathReference

        public String getPathReference()
        Method for accesing description of path that lead to the problem that triggered this exception
      • prependPath

        public void prependPath(Object referrer,
                       String fieldName)
        Method called to prepend a reference information in front of current path
      • prependPath

        public void prependPath(Object referrer,
                       int index)
        Method called to prepend a reference information in front of current path
      • getMessage

        public String getMessage()
        Method is overridden so that we can properly inject description of problem path, if such is defined.
        Overrides:
        getMessage in class com.fasterxml.jackson.core.JsonProcessingException
      • _buildMessage

        protected String _buildMessage()
      • toString

        public String toString()
        Overrides:
        toString in class com.fasterxml.jackson.core.JsonProcessingException
      • _appendPathDesc

        protected void _appendPathDesc(StringBuilder sb)

Copyright © 2012-2013 FasterXML. All Rights Reserved.