Skip to content

Interval deserialization fails for negative start instants #46

@dgrabows

Description

@dgrabows

The root cause appears to be that the code detects the hyphen from the negative number as the hyphen separating the two timestamps, causing a failed attempt to parse an empty string into a long.

For example, the following JSON representing a list of Intervals containing a single item

["-9223372036854775808-23"]

results in the following exception and stack trace

java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Long.parseLong(Long.java:431)
    at java.lang.Long.valueOf(Long.java:525)
    at com.fasterxml.jackson.datatype.joda.deser.IntervalDeserializer.deserialize(IntervalDeserializer.java:28)
    at com.fasterxml.jackson.datatype.joda.deser.IntervalDeserializer.deserialize(IntervalDeserializer.java:14)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:230)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:207)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:23)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromArray(BeanDeserializerBase.java:1112)
    ... 32 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions