Closed basil-bourque closed 10 years ago
The source code can be found on OpenJDK; The mercurial repository is: http://hg.openjdk.java.net/jdk8/jdk8/jdk
The corresponding JDK Bug is: https://bugs.openjdk.java.net/browse/JDK-8032051
See OpenJDK issue 8032051 for fix in future update.
According to both the Wikipedia page on ISO 8601 http://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC and RFC 3339: http://www.ietf.org/rfc/rfc3339.txt …the ISO 8601 standard permits short time zone offsets such as "-01" in place of the longer "-01:00".
The documentation for ZonedDateTime.parse method claims to handle ISO 8601 strings. But these short time zone offsets fail to parse. An exception is thrown.
This line of source code succeeds…
ZonedDateTime zonedDateTime = ZonedDateTime.parse( "2014-01-17T16:45:30.528-01:00" );
This fails… (note the missing ":00" at the end)
ZonedDateTime zonedDateTime = ZonedDateTime.parse( "2014-01-17T16:45:30.528-01" );
In Java 8 Build b123 on Mac OS X Mavericks 10.9.1, that failing line throws:
java.time.format.DateTimeParseException: Text '2014-01-17T16:45:30.528-01' could not be parsed at index 23
Yesterday, I filed this issue as Bug Id: 9009717 on the Java Bug Database at http://bugs.sun.com. I'm not sure if that was the correct place, so I filed the same issue here in the ticket.
I would have looked at the "parse" method source code myself, but I do not know how to obtain the Java 8 early release source code.