-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
1.3.0
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2082276 | 5.0 | Jeff Suttor | P3 | Closed | Fixed | b46 |
Name: erR10175 Date: 03/31/2004
Two methods in the class javax.xml.datatype.XMLGregorianCalendar
public GregorianCalendar toGregorianCalendar()
public GregorianCalendar toGregorianCalendar(TimeZone timezone, Locale aLocale, XMLGregorianCalendar defaults)
throw NullPointerException when an instance of the XMLGregorianCalendar
class has the year field undefined.
The javadoc of the first method reads:
"
When this instance has an undefined field, this conversion relies on the
java.util.GregorianCalendar default for its corresponding field.
"
And according to the javadoc the methods don't throw NullPointerException.
The bug affects the following new JCK-15 beta2 tests:
api/javax_xml/datatype/XMLGregorianCalendar/index.html#ConvertTo[ToGregorianCalendar006]
api/javax_xml/datatype/XMLGregorianCalendar/index.html#ConvertTo[ToGregorianCalendar007]
The bug is found in jdk1.5.0/beta2/b44. Those tests are in KFL with the RI bug
4971612 XMLGregorianCalendar.toXMLFormat() uses broken format
To reproduce the bug compile and run the following code as shown in the log below.
------------------------------------------ test.java
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.GregorianCalendar;
class test {
public static void main(String [] args) {
XMLGregorianCalendar xmlCalendar
= XMLGregorianCalendar.parse("13:14:15.162Z");
GregorianCalendar calendar = xmlCalendar.toGregorianCalendar();
System.out.println("OK");
}
}
----------------------------------------------------
------------------------------------------------ log
$javac test.java && java -cp . -showversion test
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b44)
Java HotSpot(TM) Server VM (build 1.5.0-beta2-b44, mixed mode)
Exception in thread "main" java.lang.NullPointerException
at javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar(XMLGregorianCalendar.java:2296)
at test.main(test.java:9)
----------------------------------------------------
======================================================================
Two methods in the class javax.xml.datatype.XMLGregorianCalendar
public GregorianCalendar toGregorianCalendar()
public GregorianCalendar toGregorianCalendar(TimeZone timezone, Locale aLocale, XMLGregorianCalendar defaults)
throw NullPointerException when an instance of the XMLGregorianCalendar
class has the year field undefined.
The javadoc of the first method reads:
"
When this instance has an undefined field, this conversion relies on the
java.util.GregorianCalendar default for its corresponding field.
"
And according to the javadoc the methods don't throw NullPointerException.
The bug affects the following new JCK-15 beta2 tests:
api/javax_xml/datatype/XMLGregorianCalendar/index.html#ConvertTo[ToGregorianCalendar006]
api/javax_xml/datatype/XMLGregorianCalendar/index.html#ConvertTo[ToGregorianCalendar007]
The bug is found in jdk1.5.0/beta2/b44. Those tests are in KFL with the RI bug
4971612 XMLGregorianCalendar.toXMLFormat() uses broken format
To reproduce the bug compile and run the following code as shown in the log below.
------------------------------------------ test.java
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.GregorianCalendar;
class test {
public static void main(String [] args) {
XMLGregorianCalendar xmlCalendar
= XMLGregorianCalendar.parse("13:14:15.162Z");
GregorianCalendar calendar = xmlCalendar.toGregorianCalendar();
System.out.println("OK");
}
}
----------------------------------------------------
------------------------------------------------ log
$javac test.java && java -cp . -showversion test
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b44)
Java HotSpot(TM) Server VM (build 1.5.0-beta2-b44, mixed mode)
Exception in thread "main" java.lang.NullPointerException
at javax.xml.datatype.XMLGregorianCalendar.toGregorianCalendar(XMLGregorianCalendar.java:2296)
at test.main(test.java:9)
----------------------------------------------------
======================================================================
- backported by
-
JDK-2082276 XMLGregorianCalendar.toGregorianCalendar methods throw NPE if year is undefined
- Closed