harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hindess <mark.hind...@googlemail.com>
Subject Re: [testing] Proposed fix for PriorityQueue
Date Wed, 01 Sep 2010 10:55:57 GMT

In message <4C7E3081.8030204@gmail.com>, Tim Ellison writes:
>
> 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(Prior
> ityQueueTest.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.

+1

-Mark.




Mime
View raw message