commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1311344 - /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
Date Mon, 09 Apr 2012 17:27:16 GMT
Author: tn
Date: Mon Apr  9 17:27:15 2012
New Revision: 1311344

URL: http://svn.apache.org/viewvc?rev=1311344&view=rev
Log:
[COLLECTIONS-400] Added missing null check, thanks to Shin Hwei Tan.

Modified:
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java?rev=1311344&r1=1311343&r2=1311344&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
Mon Apr  9 17:27:15 2012
@@ -782,6 +782,9 @@ public class CollectionUtils {
      * @since Commons Collections 3.2
      */
     public static <T> boolean addIgnoreNull(Collection<T> collection, T object)
{
+        if (collection == null) {
+            throw new NullPointerException("The collection must not be null");
+        }
         return (object != null && collection.add(object));
     }
 



Mime
View raw message