-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.4.0
-
x86
-
windows_nt
Name: jk109818 Date: 01/15/2002
FULL PRODUCT VERSION :
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, interpreted mode)
FULL OPERATING SYSTEM VERSION :
Windows NT Version 4.0
A DESCRIPTION OF THE PROBLEM :
java.sql.TimeStamp.compareTo(Object o)
speicifies that
"
/**
* Compares this Timestamp to another Object. If the Object
is
* a Date, this function behaves like compareTo(Timestamp).
* Otherwise, it throws aClassCastException (as Timestamps
are
* comparable only to other Timestamps)
...etc...
*/
However the code will always throw a ClassCastException for
Date.
Source from src.zip:
public int compareTo(Object o) {
return compareTo((Timestamp)o);
}
This is not backwardly compatable with version 3.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. call java.sql.Timestamp.compareTo(Object o)
where Object o is a class of type date
EXPECTED VERSUS ACTUAL BEHAVIOR :
CompareTo should work for comparison with Date objects.
Instead it throws a ClassCastException
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Level : 0
java.lang.ClassCastException: java.util.Date
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Date d = new Date();
Timestamp t = new Timestamp((long)123456);
t.compareTo(d); // Class cast will occur here
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Replace with 1.3.1 class.
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was knwon to work. Since then there has been a regression.
(Review ID: 138011)
======================================================================