mas         2002/06/14 20:52:24

  Modified:    collections/src/java/org/apache/commons/collections
                        CursorableLinkedList.java
  Log:
  Fix NullPointerException in CursorableLinkedList.remove(Object) and
  CursorableLinkedList.contains(Object) methods when the argument is
  null.
  
  Revision  Changes    Path
  1.7       +7 -6      
jakarta-commons/collections/src/java/org/apache/commons/collections/CursorableLinkedList.java
  
  Index: CursorableLinkedList.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/CursorableLinkedList.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CursorableLinkedList.java 12 Jun 2002 03:59:15 -0000      1.6
  +++ CursorableLinkedList.java 15 Jun 2002 03:52:24 -0000      1.7
  @@ -263,7 +263,8 @@
        */
       public boolean contains(Object o) {
           for(Listable elt = _head.next(), past = null; null != elt && past != 
_head.prev(); elt = (past = elt).next()) {
  -            if((null == o && null == elt.value()) || (o.equals(elt.value()))) {
  +            if((null == o && null == elt.value()) || 
  +               (o != null && o.equals(elt.value()))) {
                   return true;
               }
           }
  @@ -530,7 +531,7 @@
               if(null == o && null == elt.value()) {
                   removeListable(elt);
                   return true;
  -            } else if(o.equals(elt.value())) {
  +            } else if(o != null && o.equals(elt.value())) {
                   removeListable(elt);
                   return true;
               }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to