com.fasterxml.jackson.databind

Class JsonMappingException

    • Field Detail

      • _processor

        protected transient Closeable _processor
        Underlying processor (JsonParser or JsonGenerator), if known.

        NOTE: typically not serializable hence transient

        Since:
        2.7
    • Constructor Detail

      • JsonMappingException

        @Deprecated
        public JsonMappingException(String msg)
        Deprecated. Since 2.7 Use variant that takes JsonParser instead
      • JsonMappingException

        @Deprecated
        public JsonMappingException(String msg,
                                                Throwable rootCause)
        Deprecated. Since 2.7 Use variant that takes JsonParser instead
      • JsonMappingException

        @Deprecated
        public JsonMappingException(String msg,
                                                com.fasterxml.jackson.core.JsonLocation loc)
        Deprecated. Since 2.7 Use variant that takes JsonParser instead
      • JsonMappingException

        @Deprecated
        public JsonMappingException(String msg,
                                                com.fasterxml.jackson.core.JsonLocation loc,
                                                Throwable rootCause)
        Deprecated. Since 2.7 Use variant that takes JsonParser instead
      • JsonMappingException

        public JsonMappingException(Closeable processor,
                                    String msg)
        Since:
        2.7
      • JsonMappingException

        public JsonMappingException(Closeable processor,
                                    String msg,
                                    com.fasterxml.jackson.core.JsonLocation loc)
        Since:
        2.7
    • Method Detail

      • fromUnexpectedIOE

        public static JsonMappingException fromUnexpectedIOE(IOException src)
        Factory method used when "upgrading" an 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

        Since:
        2.1
      • 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 accessing 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
        Specified by:
        prependPath in class DatabindException
      • prependPath

        public void prependPath(Object referrer,
                                int index)
        Method called to prepend a reference information in front of current path
        Specified by:
        prependPath in class DatabindException
      • getProcessor

        public Object getProcessor()
        Overrides:
        getProcessor in class com.fasterxml.jackson.core.JsonProcessingException
      • 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
      • _appendReferenceChain

        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.
        Since:
        2.18.2
      • _appendPathDesc

        protected void _appendPathDesc(StringBuilder sb)

Copyright © 2008–2024 FasterXML. All rights reserved.