Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interval deserialization fails for negative start instants #46

Closed
dgrabows opened this issue Aug 27, 2014 · 1 comment
Closed

Interval deserialization fails for negative start instants #46

dgrabows opened this issue Aug 27, 2014 · 1 comment
Milestone

Comments

@dgrabows
Copy link

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
@cowtowncoder
Copy link
Member

Interesting. Sounds like it'd make sense to start searching from index 1 (alternative of 'lastIndexOf()' could have similar issues if second value may be negative as well?).
Although code should probably use a regexp matching (or such) for full robustness.

@cowtowncoder cowtowncoder added this to the 2.4.3 milestone Aug 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants