Name: erR10175 Date: 12/22/2003
The following method of the class javax.xml.datatype.XMLGregorianCalendar
public String toXMLFormat()
returns invalid strings for valid values.
This bug affects new test in JCK 1.5 (not integrated yet)
api/javax_xml/datatype/XMLGregorianCalendar/index.html#XMLGregorianCalendar[ToXMLFormat002]
The bug is found in jdk1.5.0/beta/b32.
To reproduce the bug compile and run the following code as shown
in the log below:
------------------------------------------ test.java
import javax.xml.datatype.XMLGregorianCalendar;
class test {
public static void main(String [] args) {
XMLGregorianCalendar calendar
= XMLGregorianCalendar.createDate(1970, 1, 1, 300);
String returned = calendar.toXMLFormat();
if ("1970-01-01+05:00".equals(returned)) {
System.out.println("OK");
} else {
System.out.println("Failed: returned " + returned
+ ", expected 1970-01-01+05:00");
}
}
}
----------------------------------------------------
------------------------------------------------ log
$javac test.java && java -cp . -showversion test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32, mixed mode)
Failed: returned 1970-01-03/12/19z, expected 1970-01-01+05:00
----------------------------------------------------
======================================================================