-
Bug
-
Resolution: Fixed
-
P3
-
1.1.4
-
1.1.6
-
sparc
-
solaris_2.5
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2016943 | 1.2.0 | Brian Beck | P3 | Resolved | Fixed | 1.2beta3 |
Name: mgC56079 Date: 09/15/97
java.text.RuleBasedCollator.equals(null) throws NullPointerException.
Should return false.
--- Here is the general contract of equals() (see JLS, 20.1.3) ----
20.1.3 public boolean equals(Object obj)
This method indicates whether some other object is "equal to" this one.
The general contract of equals is that it implements an equivalence relation:
It is reflexive: for any reference value x, x.equals(x) should return true.
It is symmetric: for any reference values x and y, x.equals(y) should return
true if and only if y.equals(x) returns true.
It is transitive: for any reference values x, y, and z, if x.equals(y) returns
true and y.equals(z) returns true, then x.equals(z) should return true.
It is consistent: for any reference values x and y, multiple invocations of
x.equals(y) consistently return true or consistently return false, provided
no information used by x and y in equals comparisons is modified.
For any non-null reference value x, x.equals(null) should return false.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---------Here is the test demonstrating the bug (RBC.java) --------------
import java.text.*;
public class RBC {
public static void main(String args[]) {
try {
RuleBasedCollator rbc=new RuleBasedCollator("< a < b");
System.out.println(rbc.equals(null));
}
catch (ParseException e) {
System.out.println(e);
}
}
}
---------Output from the test---------------------
% java RBC
java.lang.NullPointerException
at java.text.Collator.equals(Collator.java:407)
at java.text.RuleBasedCollator.equals(RuleBasedCollator.java:485)
at RBC.main(RBC.java:9)
--------------------------------------------------
======================================================================
- backported by
-
JDK-2016943 java.text.RuleBasedCollator.equals(null) throws NullPointerException
-
- Resolved
-