-
Bug
-
Resolution: Fixed
-
P3
-
1.4.2
-
tiger
-
generic
-
generic
-
Verified
Name: aaR10208 Date: 03/05/2003
Filed By : J2SE-SQA [###@###.###
JDK : JDK1.4.2-b17
Testbase : RegTest-test
Platform[s] : generic
switch/Mode : -client
Falling test[s]:javax/swing/text/InternationalFormatter/4613812/bug4613812.java
Here is a part of the test source code
(file:javax/swing/text/InternationalFormatter/4613812/bug4613812.java):
======
21 // calculate date range
22 Calendar cal = Calendar.getInstance();
23 Date today = cal.getTime();
24 int day = cal.get(Calendar.DAY_OF_MONTH);
25
26 cal.setLenient(true);
! 27 cal.set(Calendar.DAY_OF_MONTH, day-5);
! 28 Date min = cal.getTime();
! 29 cal.set(Calendar.DAY_OF_MONTH, day+5);
! 30 Date max = cal.getTime();
31
32 // set date range
33 formatter.setMinimum(min);
34 formatter.setMaximum(max);
35 text.setValue(today);
36
37 text.setValue(max);
38 Date value = (Date)text.getValue();
! 39 if (! value.after(today)) {
40 throw new RuntimeException("Failed: maximum date not set");
41 }
======
The test tries to calculate a date range [today-5 days, today + 5 days] at the lines 27-30.
The problem is that the tests does not check the current DAY_OF_MONTH, and if the current
day of month is less than 6, the "min" date will be at the previous month and the "max" date
will be at the previous month too, so the check at line 39 will fail.
Test source location:
=====================
/java/re/jdk/1.4.2/promoted/latest/ws/j2se/test/javax/swing/text/InternationalFormatter/4613812/bug4613812.java
jtr file location:
==================
/net/jtgb4u4c.sfbay/export/sail15/results/mantis/b17/regtest/win32/workDir/test/javax/swing/text/InternationalFormatter/4613812/bug4613812.jtr
How to reproduce:
=================
Run the following script (you may need to change its variables)
--- script start ---
#!/bin/sh
JDK=k:/jdk1.4.2/win32/
TESTBASE=k:/regtest/test
cp ${TESTBASE}/javax/swing/text/InternationalFormatter/4613812/bug4613812.java .
${JDK}/bin/javac bug4613812.java
${JDK}/bin/java -showversion bug4613812
--- script end ---
Test output:
===========
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b17)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b17, mixed mode)
Exception in thread "main" java.lang.RuntimeException: Failed: maximum date not set
at bug4613812.main(bug4613812.java:40)
Specific machine info:
======================
Hostname: linux-17
OS: Windows 98
======================================================================
Filed By : J2SE-SQA [###@###.###
JDK : JDK1.4.2-b17
Testbase : RegTest-test
Platform[s] : generic
switch/Mode : -client
Falling test[s]:javax/swing/text/InternationalFormatter/4613812/bug4613812.java
Here is a part of the test source code
(file:javax/swing/text/InternationalFormatter/4613812/bug4613812.java):
======
21 // calculate date range
22 Calendar cal = Calendar.getInstance();
23 Date today = cal.getTime();
24 int day = cal.get(Calendar.DAY_OF_MONTH);
25
26 cal.setLenient(true);
! 27 cal.set(Calendar.DAY_OF_MONTH, day-5);
! 28 Date min = cal.getTime();
! 29 cal.set(Calendar.DAY_OF_MONTH, day+5);
! 30 Date max = cal.getTime();
31
32 // set date range
33 formatter.setMinimum(min);
34 formatter.setMaximum(max);
35 text.setValue(today);
36
37 text.setValue(max);
38 Date value = (Date)text.getValue();
! 39 if (! value.after(today)) {
40 throw new RuntimeException("Failed: maximum date not set");
41 }
======
The test tries to calculate a date range [today-5 days, today + 5 days] at the lines 27-30.
The problem is that the tests does not check the current DAY_OF_MONTH, and if the current
day of month is less than 6, the "min" date will be at the previous month and the "max" date
will be at the previous month too, so the check at line 39 will fail.
Test source location:
=====================
/java/re/jdk/1.4.2/promoted/latest/ws/j2se/test/javax/swing/text/InternationalFormatter/4613812/bug4613812.java
jtr file location:
==================
/net/jtgb4u4c.sfbay/export/sail15/results/mantis/b17/regtest/win32/workDir/test/javax/swing/text/InternationalFormatter/4613812/bug4613812.jtr
How to reproduce:
=================
Run the following script (you may need to change its variables)
--- script start ---
#!/bin/sh
JDK=k:/jdk1.4.2/win32/
TESTBASE=k:/regtest/test
cp ${TESTBASE}/javax/swing/text/InternationalFormatter/4613812/bug4613812.java .
${JDK}/bin/javac bug4613812.java
${JDK}/bin/java -showversion bug4613812
--- script end ---
Test output:
===========
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b17)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b17, mixed mode)
Exception in thread "main" java.lang.RuntimeException: Failed: maximum date not set
at bug4613812.main(bug4613812.java:40)
Specific machine info:
======================
Hostname: linux-17
OS: Windows 98
======================================================================