Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2154623 | 7 | Joe Wang | P4 | Resolved | Fixed | b14 |
From jaxp issue 12:
toString method of XMLGregorianCalendar does not return a valid dateTime value.
The output contains an exponent notation in millisecond value.
The following sample will create an XMLGregorianCalendar from
2006-10-23T22:15:01.0000001+08:00, but toString will print a different and an
invalid dateTime which is 2006-10-23T22:15:01E-7+08:00
package org.gs1us.xml.test;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* @author nalmodiel
*/
public class XMLGregorianCalendarSample {
public static void main(String[] args) {
try {
String inputDateTime = "2006-10-23T22:15:01.0000001+08:00";
DatatypeFactory factory = DatatypeFactory.newInstance();
XMLGregorianCalendar calendar =
factory.newXMLGregorianCalendar(inputDateTime);
System.out.println(calendar.toString());
}
catch (Exception e) {
e.printStackTrace();
}
}
}
------- Additional comments from ndw Mon Oct 23 21:10:56 +0000 2006 -------
Added a unit test to the build. Working on it.
------- Additional comments from ndw Thu Nov 16 19:47:07 +0000 2006 -------
The fix for this is now in the HEAD
toString method of XMLGregorianCalendar does not return a valid dateTime value.
The output contains an exponent notation in millisecond value.
The following sample will create an XMLGregorianCalendar from
2006-10-23T22:15:01.0000001+08:00, but toString will print a different and an
invalid dateTime which is 2006-10-23T22:15:01E-7+08:00
package org.gs1us.xml.test;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* @author nalmodiel
*/
public class XMLGregorianCalendarSample {
public static void main(String[] args) {
try {
String inputDateTime = "2006-10-23T22:15:01.0000001+08:00";
DatatypeFactory factory = DatatypeFactory.newInstance();
XMLGregorianCalendar calendar =
factory.newXMLGregorianCalendar(inputDateTime);
System.out.println(calendar.toString());
}
catch (Exception e) {
e.printStackTrace();
}
}
}
------- Additional comments from ndw Mon Oct 23 21:10:56 +0000 2006 -------
Added a unit test to the build. Working on it.
------- Additional comments from ndw Thu Nov 16 19:47:07 +0000 2006 -------
The fix for this is now in the HEAD
- backported by
-
JDK-2154623 toString method of XMLGregorianCalendar does not return a valid dateTime value
-
- Resolved
-