Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2076565 | 5.0 | Kohsuke Kawaguchi | P3 | Closed | Fixed | b30 |
Name: erR10175 Date: 10/30/2003
The following methods of the class javax.xml.datatype.Duration
public Duration multiply(int factor)
public final Duration multiply(BigDecimal factor)
does not multiply seconds in the duration.
The documentation of the methods reads:
"Computes a new duration whose value is factor times longer than the value
of this duration."
So for example, the duration "PT1M1S" and the factor 2 must produce "PT2M2S",
but both methods return "PT2M1S".
This bug affects new test in JCK 1.5 (not yet integrated)
api/javax_xml/datatype/Duration/index.html#DurationTests[Multiply001]
api/javax_xml/datatype/Duration/index.html#DurationTests[Multiply002]
The bug is found in jdk1.5.0/beta/b25.
To reproduce the bug compile and run the following code as shown
in the log below:
------------------------------ test.java
import javax.xml.datatype.Duration;
import java.math.BigDecimal;
public class test {
public static void main(String [] args) {
System.out.println("new Duration(\"PT1M1S\").multiply(2) returns "
+ new Duration("PT1M1S").multiply(2)
+ ", expected PT2M2S");
System.out.println("new Duration(\"PT1M1S\")"
+".multiply(new BigDecimal(\"2\")) returns "
+ new Duration("PT1M1S").multiply(new BigDecimal("2"))
+ ", expected PT2M2S");
}
}
----------------------------------------------------
------------------------------------------------ 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-b25)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b25, mixed mode)
new Duration("PT1M1S").multiply(2) returns PT2M1S, expected PT2M2S
new Duration("PT1M1S").multiply(new BigDecimal("2")) returns PT2M1S, expected PT2M2S
----------------------------------------------------
======================================================================
The following methods of the class javax.xml.datatype.Duration
public Duration multiply(int factor)
public final Duration multiply(BigDecimal factor)
does not multiply seconds in the duration.
The documentation of the methods reads:
"Computes a new duration whose value is factor times longer than the value
of this duration."
So for example, the duration "PT1M1S" and the factor 2 must produce "PT2M2S",
but both methods return "PT2M1S".
This bug affects new test in JCK 1.5 (not yet integrated)
api/javax_xml/datatype/Duration/index.html#DurationTests[Multiply001]
api/javax_xml/datatype/Duration/index.html#DurationTests[Multiply002]
The bug is found in jdk1.5.0/beta/b25.
To reproduce the bug compile and run the following code as shown
in the log below:
------------------------------ test.java
import javax.xml.datatype.Duration;
import java.math.BigDecimal;
public class test {
public static void main(String [] args) {
System.out.println("new Duration(\"PT1M1S\").multiply(2) returns "
+ new Duration("PT1M1S").multiply(2)
+ ", expected PT2M2S");
System.out.println("new Duration(\"PT1M1S\")"
+".multiply(new BigDecimal(\"2\")) returns "
+ new Duration("PT1M1S").multiply(new BigDecimal("2"))
+ ", expected PT2M2S");
}
}
----------------------------------------------------
------------------------------------------------ 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-b25)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b25, mixed mode)
new Duration("PT1M1S").multiply(2) returns PT2M1S, expected PT2M2S
new Duration("PT1M1S").multiply(new BigDecimal("2")) returns PT2M1S, expected PT2M2S
----------------------------------------------------
======================================================================
- backported by
-
JDK-2076565 Duration.multiply() does not multiply seconds
- Closed