classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: fix PR classpath/22986


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: fix PR classpath/22986
Date: 25 Jul 2005 12:32:06 -0600

I'm checking this in.

FindBugs pointed out that we were using equals() to compare arrays.
In this case, this is incorrect, and we want Arrays.equals().

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>
        * java/text/CollationKey.java (equals): Use Arrays.equals.
        PR classpath/22986.

Index: java/text/CollationKey.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/CollationKey.java,v
retrieving revision 1.15
diff -u -r1.15 CollationKey.java
--- java/text/CollationKey.java 23 Jul 2005 20:25:15 -0000 1.15
+++ java/text/CollationKey.java 25 Jul 2005 18:26:23 -0000
@@ -38,6 +38,8 @@
 
 package java.text;
 
+import java.util.Arrays;
+
 /* Written using "Java Class Libraries", 2nd edition, plus online
  * API docs for JDK 1.2 from http://www.javasoft.com.
  * Status: Believed complete and correct.
@@ -154,7 +156,7 @@
     if (!ck.getSourceString ().equals (getSourceString ()))
       return false;
 
-    if (!ck.toByteArray ().equals (toByteArray ()))
+    if (! Arrays.equals (ck.toByteArray (), toByteArray ()))
       return false;
 
     return true;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]