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 ArrayEnumeration.java
Date Sun, 24 Mar 2002 21:50:24 GMT
mas         02/03/24 13:50:24

  Modified:    collections/src/java/org/apache/commons/collections
                        ArrayEnumeration.java
  Log:
  Rather than throw a NullPointerException during hasMoreElements or nextElement
  when no array is passed to the constructor, treat a null to the constructor as
  an empty array.
  
  Revision  Changes    Path
  1.4       +8 -4      jakarta-commons/collections/src/java/org/apache/commons/collections/ArrayEnumeration.java
  
  Index: ArrayEnumeration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ArrayEnumeration.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArrayEnumeration.java	18 Mar 2002 23:49:20 -0000	1.3
  +++ ArrayEnumeration.java	24 Mar 2002 21:50:24 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ArrayEnumeration.java,v
1.3 2002/03/18 23:49:20 morgand Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/03/18 23:49:20 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ArrayEnumeration.java,v
1.4 2002/03/24 21:50:24 mas Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/03/24 21:50:24 $
    *
    * ====================================================================
    *
  @@ -87,7 +87,11 @@
   
       public ArrayEnumeration( final Object[] elements )
       {
  -        m_elements = elements;
  +        if(elements == null) {
  +            m_elements = new Object[0];
  +        } else {
  +            m_elements = elements;
  +        }
       }
   
       public boolean hasMoreElements()
  
  
  

--
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