commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections CursorableLinkedList.java
Date Sat, 15 Jun 2002 03:52:24 GMT
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:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message