-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
1.3
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2082298 | 5.0 | Jeff Suttor | P3 | Closed | Fixed | b49 |
Name: erR10175 Date: 03/31/2004
The method of the class javax.xml.datatype.XMLGregorianCalendar
public static XMLGregorianCalendar parse(String lexicalRepresentation)
does not throw IllegalArgumentException in case when the date '1999-02-29'
is parsed.
The javadoc of the method reads:
"
Returns a non-null valid XMLGregorianCalendar object that holds
the value indicated by the lexicalRepresentation parameter.
...
Throws:
IllegalArgumentException - If the given string does not conform to
the aforementioned specification.
"
So, if the method returns a value, the value must be valid (i.e. method
isValid() should return true), otherwise IllegalArgumentException should
be thrown. As the year 1999 is not leap the date '1999-02-29' is not
valid and IllegalArgumentException should be thrown.
The bug affects the following new JCK-15 beta2 test:
api/javax_xml/datatype/XMLGregorianCalendar/index.html#Parse[Parse003]
The bug is found in jdk1.5.0/beta2/b44. The test is in KFL with the RI bug
4972888 XMLGregorianCalendar.parse throws StringIndexOutOfBoundsException
To reproduce the bug compile and run th e following code as shown in the log below.
------------------------------------------ test.java
import javax.xml.datatype.XMLGregorianCalendar;
class test {
public static void main(String [] args) {
try {
XMLGregorianCalendar calendar
= XMLGregorianCalendar.parse("1999-02-29");
if (!calendar.isValid()) {
System.out.println("Failed: isValid() returns false");
}
System.out.println("Failed: IllegalArgumentException is not thrown");
} catch (IllegalArgumentException e) {
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)
Failed: isValid() returns false
Failed: IllegalArgumentException is not thrown
----------------------------------------------------
======================================================================
The method of the class javax.xml.datatype.XMLGregorianCalendar
public static XMLGregorianCalendar parse(String lexicalRepresentation)
does not throw IllegalArgumentException in case when the date '1999-02-29'
is parsed.
The javadoc of the method reads:
"
Returns a non-null valid XMLGregorianCalendar object that holds
the value indicated by the lexicalRepresentation parameter.
...
Throws:
IllegalArgumentException - If the given string does not conform to
the aforementioned specification.
"
So, if the method returns a value, the value must be valid (i.e. method
isValid() should return true), otherwise IllegalArgumentException should
be thrown. As the year 1999 is not leap the date '1999-02-29' is not
valid and IllegalArgumentException should be thrown.
The bug affects the following new JCK-15 beta2 test:
api/javax_xml/datatype/XMLGregorianCalendar/index.html#Parse[Parse003]
The bug is found in jdk1.5.0/beta2/b44. The test is in KFL with the RI bug
4972888 XMLGregorianCalendar.parse throws StringIndexOutOfBoundsException
To reproduce the bug compile and run th e following code as shown in the log below.
------------------------------------------ test.java
import javax.xml.datatype.XMLGregorianCalendar;
class test {
public static void main(String [] args) {
try {
XMLGregorianCalendar calendar
= XMLGregorianCalendar.parse("1999-02-29");
if (!calendar.isValid()) {
System.out.println("Failed: isValid() returns false");
}
System.out.println("Failed: IllegalArgumentException is not thrown");
} catch (IllegalArgumentException e) {
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)
Failed: isValid() returns false
Failed: IllegalArgumentException is not thrown
----------------------------------------------------
======================================================================
- backported by
-
JDK-2082298 XMLGregorianCalendar: parse() doesn't throw IAE for '1999-02-29'
- Closed