JDK-4227983 : java.sql.Timestamp didn't overload compareTo, setTime and getTime
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.sql
  • Affected Version: 1.2.1,1.2.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_nt
  • CPU: generic,x86
  • Submitted: 1999-04-08
  • Updated: 2000-04-10
  • Resolved: 2000-04-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 betaFixed
Related Reports
Relates :  
Description

Name: krT82822			Date: 04/08/99


Package java.sql
Timestamp does not overload compareTo Method (Comparable Interface)
which is inherited from java.util.Date. So compareTo compares
only the Date value of the Timestamp and ignores the nanos!!!

Also setTime and getTime must be overloaded because otherwise
the nanos are not considered correctly (also in jdk1.1).
Constructor Timestamp(long) handle these correctly.

I've reported this bug on 25.01.99 (ID: 53126) but I've never found
it in the Bug-List
(Review ID: 56715) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin FIXED IN: merlin-beta INTEGRATED IN: merlin-beta
14-06-2004

EVALUATION Comparable seems to have been added to java.util.Date in 1.2. Java.sql.Timestamp was not updated at the same time. The get set/getTime problem has always been there. I presume the correct behaviour would be to zero out the nanos.
11-06-2004