Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2181810 | 6u18 | Joe Wang | P4 | Resolved | Fixed | b02 |
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();
}
}
}
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();
}
}
}
- backported by
-
JDK-2181810 jaxp issue 12: toString method of XMLGregorianCalendar does not return a valid dateTime value
-
- Resolved
-