harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject [testing] Proposed fix for PriorityQueue
Date Wed, 01 Sep 2010 10:52:49 GMT
I see a test failure in the Java 6 branch caused by my commit to match
the RI behavior,

Index: PriorityQueue.java
===================================================================
--- PriorityQueue.java	(revision 967015)
+++ PriorityQueue.java	(revision 967016)
@@ -278,7 +278,7 @@
     @Override
     public boolean contains(Object object) {
         for (int i = 0; i < size; i++) {
-            if(elements[i].equals(object)){
+            if (object.equals(elements[i])) {
                 return true;
             }
         }

causes

queue.contains(null) test to fail
 java.lang.NullPointerException
 at java.util.PriorityQueue.contains(PriorityQueue.java:281)
 at
org.apache.harmony.luni.tests.java.util.PriorityQueueTest.test_contains(PriorityQueueTest.java:734)
 at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)


So I'd like to patch it with the obvious fix,

 Index: PriorityQueue.java
 ===================================================================
 --- PriorityQueue.java	(revision 990403)
 +++ PriorityQueue.java	(working copy)
 @@ -277,6 +277,9 @@
       */
      @Override
      public boolean contains(Object object) {
 +        if (object == null) {
 +            return false;
 +        }
          for (int i = 0; i < size; i++) {
              if (object.equals(elements[i])) {
                  return true;

I'm looking for another committers support for this during the code freeze.

Regards,
Tim

Mime
View raw message