FULL PRODUCT VERSION :
1.6.0_02-b05
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2
A DESCRIPTION OF THE PROBLEM :
java.util.Date.equals(Object) method is not symmetric as required by the contract.
The behavior was observed on both 1.4 and 1.5 versions.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the test class provided.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should print:
false
false
ACTUAL -
true
false
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class Test {
public static void main(String[] args) {
java.util.Date a = new java.util.Date();
java.sql.Timestamp b = new java.sql.Timestamp(a.getTime());
System.out.println(a.equals(b));
System.out.println(b.equals(a));
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is no workaround.
1.6.0_02-b05
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2
A DESCRIPTION OF THE PROBLEM :
java.util.Date.equals(Object) method is not symmetric as required by the contract.
The behavior was observed on both 1.4 and 1.5 versions.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the test class provided.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should print:
false
false
ACTUAL -
true
false
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class Test {
public static void main(String[] args) {
java.util.Date a = new java.util.Date();
java.sql.Timestamp b = new java.sql.Timestamp(a.getTime());
System.out.println(a.equals(b));
System.out.println(b.equals(a));
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is no workaround.
- duplicates
-
JDK-4170629 TimeStamp violates Object.hashCode contract in two ways
-
- Closed
-
- relates to
-
JDK-6609514 A.equals(B) != B.equals(A) when A,B are java.util.Date objects
-
- Closed
-