Skip to content

JSONMappingException Location column number is one line Behind the actual location #2482

@aslamkam

Description

@aslamkam

Hi all,

On Jackson 2.9.8(Also attempted with 2.10.0.pr3), when sending JSON of the type JSON Request.txt:

{
 CustomerType: "A",
 "Status": 123
} 

The CustomerType is not enclosed in quotation marks and raises a JSONMappingException.
The exception raised has its column number one less than the actual location of the syntax error.

For example, in the JSON Request.txt, the column number in exception would be 1, when it actually should be 2.

I've ran similar loads against Jackson 2.2.3 and this error did not happen then.
Typo JSON.txt

{
 "CustomerTpe": "A",
 "Status": 123
}

In TypoJSON.txt, a JSONMappingException is also raised but the line number is accurate.(its 2)

I did a little more digging into the code,
JSONRequest.txt causes JSONParseException before it is converted to JSONMappingException
TypoJSON.txt causes UnRecognizedPropertyException before it is cast into JSONMappingException.

UnRecognizedPropertyException inherits from JSONMappingException while JSONParseException does not.

During the conversion process to JSONMappingException, JSONParseExcpetion's error location is overwritten by the JSONReader's location which is one line behind the actual syntax error.

If this is the intended behavior, please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions