[JAVA-1768] JsonReader doesn't parse ISODate strings in $date fields Created: 17/Apr/15  Updated: 05/May/15  Resolved: 19/Apr/15

Status: Closed
Project: Java Driver
Component/s: JSON
Affects Version/s: 3.0.0
Fix Version/s: 3.0.1, 3.1.0

Type: Improvement Priority: Minor - P4
Reporter: Florian Bücklers Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

all



 Description   

The JsonReader doesn't parse ISODateStrings in extended JSON format.

{ "$date" : "2015-04-16T14:55:57.626Z" } { "$date" : "2015-04-16T16:55:57.626+02:00" }

The older JSONCallback based parser account this case.



 Comments   
Comment by Jeffrey Yemin [ 05/May/15 ]

Closed for 3.0.1 release.

Comment by Githook User [ 19/Apr/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: In JsonReader, replaced SimpleDateFormat with DatatypeConverter.parseDateTime, as Java 6 does not support the 'X' pattern character.

JAVA-1768
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/ff12786cfeecc509674c3171ea7fd07621050b42

Comment by Githook User [ 19/Apr/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: In JsonReader, replaced SimpleDateFormat with DatatypeConverter.parseDateTime, as Java 6 does not support the 'X' pattern character.

JAVA-1768
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/0f02e65b4f50b0d1bb8891678929816f5c189158

Comment by Jeffrey Yemin [ 19/Apr/15 ]

Re-opening because SimpleDateFormat doesn't support the 'X' pattern character until Java 7, but the driver must run on Java 6.

Comment by Jeffrey Yemin [ 17/Apr/15 ]

Still internally discussing the right behavior of JsonWriter, so to move this forward I'll open that as a separate ticket.

Comment by Florian Bücklers [ 17/Apr/15 ]

I can also add the JsonWriter logic as well, if it helps to solve the ticket. Do wan't to write all $date values as strings by default now?

Comment by Florian Bücklers [ 17/Apr/15 ]

I have created a pull request: https://github.com/mongodb/mongo-java-driver/pull/307
There was also a issue that one SimpleDateFormat instance was not localized

Generated at Thu Feb 08 08:55:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.