Class JsonMappingException

    • Constructor Detail

      • JsonMappingException

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

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

        @Deprecated
        public JsonMappingException​(java.lang.String msg,
                                    JsonLocation loc)
        Deprecated.
        Since 2.7 Use variant that takes JsonParser instead
      • JsonMappingException

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

        public JsonMappingException​(java.io.Closeable processor,
                                    java.lang.String msg)
        Since:
        2.7
      • JsonMappingException

        public JsonMappingException​(java.io.Closeable processor,
                                    java.lang.String msg,
                                    java.lang.Throwable problem)
        Since:
        2.7
      • JsonMappingException

        public JsonMappingException​(java.io.Closeable processor,
                                    java.lang.String msg,
                                    JsonLocation loc)
        Since:
        2.7
    • Method Detail

      • fromUnexpectedIOE

        public static JsonMappingException fromUnexpectedIOE​(java.io.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​(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()
        Method for accessing full structural path within type hierarchy down to problematic property.
      • getPathReference

        public java.lang.String getPathReference()
        Method for accessing 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
        Specified by:
        prependPath in class DatabindException
      • prependPath

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

        public java.lang.Object getProcessor()
        Description copied from class: JsonProcessingException
        Method that allows accessing underlying processor that triggered this exception; typically either JsonParser or JsonGenerator for exceptions that originate from streaming API. Note that it is possible that `null` may be returned if code throwing exception either has no access to processor; or has not been retrofitted to set it; this means that caller needs to take care to check for nulls. Subtypes override this method with co-variant return type, for more type-safe access.
        Overrides:
        getProcessor in class JsonProcessingException
        Returns:
        Originating processor, if available; null if not.
      • getLocalizedMessage

        public java.lang.String getLocalizedMessage()
        Overrides:
        getLocalizedMessage in class java.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 class JsonProcessingException
        Returns:
        Original message preceded by optional prefix and followed by location information, message and location information separated by a linefeed