backoffbelief / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

Issue with date parsing in parseDateTimeFromXml #218

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Connect to an Odata service that returns a date with a nanoseconds of .999589
2.
3.

What is the expected output? What do you see instead?
Expected output is correct parsing, instead you'll get:
Caused by: java.lang.IllegalArgumentException: Invalid format: 
"2012-08-01T21:50:111.0" is malformed at "1.0"

What version of the product are you using? On what operating system?
0.8.0-pre

Please provide any additional information below.

I see the problem, in roundToMillis, it will round up to 1.0, which it should 
never do or if it does it should be more complex logic to increment the seconds 
counter.

I put some debug code in to parseDateTimeFromXml:
System.out.println(dateTime + " " + seconds + " " + nanoSeconds + " roundedto(" 
+ roundToMillis(nanoSeconds) + ")");
2012-08-01T21:50 :11 .999589 roundedto(1.0)

Original issue reported on code.google.com by jvrobe...@gmail.com on 18 Sep 2012 at 4:30

GoogleCodeExporter commented 9 years ago

Original comment by stephan....@googlemail.com on 19 Sep 2012 at 6:58

GoogleCodeExporter commented 9 years ago

Original comment by stephan....@googlemail.com on 21 Sep 2012 at 11:11