Skip to content

CsvParser.getNumberValue(), related, do not throw exception for non-numeric tokens #564

@cowtowncoder

Description

@cowtowncoder

As per Javadocs for JsonParser, numeric access tokens should only work if current token is either JsonToken.VALUE_NUMBER_INT or JsonToken.VALUE_NUMBER_FLOAT; and otherwise throw a StreamReadException. CsvParser, however, will try implicit coercion to make things work as if a number was encountered. While this makes some sense given that CSV natively has no distinction of Numbers (just String values), it is incompatible with Jackson core API, so let's change that for 2.20.

Note: in future it's possible backend could automatically expose numeric columns as numbers -- if so, calls should obviously work.
Similarly, use of CsvParser.isExpectedNumberIntToken() can convert String values into (integral) numbers; in which case calls will work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions