-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
1.3
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2098634 | 5.0 | Jeff Suttor | P3 | Resolved | Fixed | b55 |
Name: erR10175 Date: 05/18/2004
The following method of the class javax.xml.datatype.XMLGregorianCalendar
public String toString()
throws IllegalStateException if the XMLGregorianCalendar instance does not
represent any XML Schema datatype.
The javadoc of the method specifies no exception to be thrown.
This bug affects new test in JCK 1.5
api/javax_xml/datatype/XMLGregorianCalendar/index.html#ToXML[ToString001]
The bug is found in jdk1.5.0/beta/b51.
To reproduce the bug compile and run test.java as shown in the log below:
------------------------------------------ test.java
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.DatatypeConstants;
class test {
static final int undef = DatatypeConstants.FIELD_UNDEFINED;
static final int [][] values = {
{undef, undef, undef, undef, undef, undef},
{1970, 1, 1, 0, 0, 0}, // ok
{1970, 1, 1, 0, 0, undef},
{1970, 1, 1, 0, undef, 0},
{1970, 1, 1, undef, 0, 0},
{1970, 1, undef, 0, 0, 0},
{1970, undef, 1, 0, 0, 0},
{undef, 1, 1, 0, 0, 0},
{1970, 1, 1, 0, undef, undef},
{1970, 1, 1, undef, 0, undef},
{1970, 1, undef, 0, 0, undef},
{1970, undef, 1, 0, 0, undef},
{undef, 1, 1, 0, undef, 0},
{1970, undef, 1, undef, 1, undef},
};
public static void main(String [] args) throws Exception {
DatatypeFactory df = DatatypeFactory.newInstance();
String status = "Passed.";
for(int i = 0; i < values.length; ++i) {
XMLGregorianCalendar calendar
= i != 0
? df.newXMLGregorianCalendar(
values[i][0], values[i][1], values[i][2],
values[i][3], values[i][4], values[i][5],
undef, undef)
: df.newXMLGregorianCalendar();
try {
String returned = calendar.toString();
} catch (Exception e) {
System.out.println(i + ": " + e);
status = "Failed.";
}
}
System.out.println(status);
}
}
----------------------------------------------------
------------------------------------------------ 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-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode)
0: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
2: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
3: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
4: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
5: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
6: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
7: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
8: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
9: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
10: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
11: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
12: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
13: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
Failed.
----------------------------------------------------
======================================================================
The following method of the class javax.xml.datatype.XMLGregorianCalendar
public String toString()
throws IllegalStateException if the XMLGregorianCalendar instance does not
represent any XML Schema datatype.
The javadoc of the method specifies no exception to be thrown.
This bug affects new test in JCK 1.5
api/javax_xml/datatype/XMLGregorianCalendar/index.html#ToXML[ToString001]
The bug is found in jdk1.5.0/beta/b51.
To reproduce the bug compile and run test.java as shown in the log below:
------------------------------------------ test.java
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.DatatypeConstants;
class test {
static final int undef = DatatypeConstants.FIELD_UNDEFINED;
static final int [][] values = {
{undef, undef, undef, undef, undef, undef},
{1970, 1, 1, 0, 0, 0}, // ok
{1970, 1, 1, 0, 0, undef},
{1970, 1, 1, 0, undef, 0},
{1970, 1, 1, undef, 0, 0},
{1970, 1, undef, 0, 0, 0},
{1970, undef, 1, 0, 0, 0},
{undef, 1, 1, 0, 0, 0},
{1970, 1, 1, 0, undef, undef},
{1970, 1, 1, undef, 0, undef},
{1970, 1, undef, 0, 0, undef},
{1970, undef, 1, 0, 0, undef},
{undef, 1, 1, 0, undef, 0},
{1970, undef, 1, undef, 1, undef},
};
public static void main(String [] args) throws Exception {
DatatypeFactory df = DatatypeFactory.newInstance();
String status = "Passed.";
for(int i = 0; i < values.length; ++i) {
XMLGregorianCalendar calendar
= i != 0
? df.newXMLGregorianCalendar(
values[i][0], values[i][1], values[i][2],
values[i][3], values[i][4], values[i][5],
undef, undef)
: df.newXMLGregorianCalendar();
try {
String returned = calendar.toString();
} catch (Exception e) {
System.out.println(i + ": " + e);
status = "Failed.";
}
}
System.out.println(status);
}
}
----------------------------------------------------
------------------------------------------------ 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-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode)
0: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
2: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
3: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
4: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
5: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
6: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
7: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
8: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
9: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
10: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
11: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
12: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
13: java.lang.IllegalStateException: invalid set of fields set for XMLGregorianCalendar
Failed.
----------------------------------------------------
======================================================================
- backported by
-
JDK-2098634 XMLGregorianCalendar.toString throws IllegalStateException
-
- Resolved
-
-
JDK-2098635 XMLGregorianCalendar.toString throws IllegalStateException
-
- Resolved
-