-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
1.3
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2101567 | 5.0 | Ramesh Mandava | P3 | Resolved | Fixed | b57 |
Name: erR10175 Date: 06/11/2004
The default implementation of the following method of the class javax.xml.datatype.Duration
public abstract int compare(Duration duration)
throws NullPointerException if second field of the duration is undefined.
According to the javadoc of the method NPE may be thrown only if the
duration parameter is null.
The bug is found in jaxp-1.3-b18 and is not reproducible with neither
jck15-b55 nor jaxp-1.3-b17.
The bug affects the following new JAXP TCK 1.3 tests:
api/javax_xml/datatype/Duration/index.html#Duration[Compare001]
api/javax_xml/datatype/Duration/index.html#Duration[Equals001]
api/javax_xml/datatype/Duration/index.html#Duration[IsLongerThan001]
api/javax_xml/datatype/Duration/index.html#Duration[IsShorterThan001]
api/javax_xml/datatype/Duration/index.html#Multiply[Multiply001]
api/javax_xml/datatype/Duration/index.html#Multiply[Multiply002]
api/javax_xml/datatype/Duration/index.html#Negate[Negate001]
api/javax_xml/datatype/Duration/index.html#NormalizeWith[NormalizeWith001]
api/javax_xml/datatype/Duration/index.html#Subtract[Subtract001]
To reproduce the bug compile and run the following code as shown in the log below.
Set the java.endorsed.dirs property to jaxp-1.3-beta-b18 directory.
--------------------------- test.java
import javax.xml.datatype.Duration;
import javax.xml.datatype.DatatypeFactory;
class test {
public static void main(String [] args) throws Exception {
DatatypeFactory df = DatatypeFactory.newInstance();
Duration duration1 = df.newDuration("P1Y");
Duration duration2 = df.newDuration("P1YT1S");
duration1.compare(duration2);
System.out.print("Step 1: ");
duration2 = df.newDuration("P1Y");
System.out.println("Passed.");
System.out.print("Step 2: ");
duration1.compare(duration2);
System.out.println("Passed.");
}
}
-------------------------------------
--------------------------------- log
$javac test.java && java -cp . -Djava.endorsed.dirs=jaxp-1.3-beta-b18-09_jun_2004 -showversion test
java version "1.5.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b55)
Java HotSpot(TM) Client VM (build 1.5.0-beta3-b55, mixed mode)
Step 1: Passed.
Step 2: Exception in thread "main" java.lang.NullPointerException
at org.apache.xerces.jaxp.datatype.DurationImpl.compare(Unknown Source)
at test.main(test.java:15)
-------------------------------------
======================================================================
Name: erR10175 Date: 06/20/2004
The following JCK 1.5 tests fail with jdk15-b56 due to this bug:
api/javax_xml/datatype/DatatypeFactory/index.html#Duration[NewDuration003]
api/javax_xml/datatype/DatatypeFactory/index.html#Duration[NewDuration007]
api/javax_xml/datatype/DatatypeFactory/index.html#Duration[NewDuration008]
api/javax_xml/datatype/Duration/index.html#Add[Add001]
api/javax_xml/datatype/Duration/index.html#Duration[Compare001]
api/javax_xml/datatype/Duration/index.html#Duration[Equals001]
api/javax_xml/datatype/Duration/index.html#Duration[IsLongerThan001]
api/javax_xml/datatype/Duration/index.html#Duration[IsShorterThan001]
api/javax_xml/datatype/Duration/index.html#Multiply[Multiply001]
api/javax_xml/datatype/Duration/index.html#Multiply[Multiply002]
api/javax_xml/datatype/Duration/index.html#Negate[Negate001]
api/javax_xml/datatype/Duration/index.html#NormalizeWith[NormalizeWith001]
api/javax_xml/datatype/Duration/index.html#Subtract[Subtract001]
======================================================================
- backported by
-
JDK-2101567 javax.xml.datatype.Duration.compare throws NPE if second is undefined
- Resolved
-
JDK-2101568 javax.xml.datatype.Duration.compare throws NPE if second is undefined
- Closed