Author: tn
Date: Wed Oct 29 21:05:03 2014
New Revision: 1635303

URL: http://svn.apache.org/r1635303
Log:
[COLLECTIONS-536] Improved null check. Thanks to Tagir Valeev.

Modified:
    commons/proper/collections/trunk/src/changes/changes.xml
    
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java

Modified: commons/proper/collections/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/changes/changes.xml?rev=1635303&r1=1635302&r2=1635303&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/changes/changes.xml (original)
+++ commons/proper/collections/trunk/src/changes/changes.xml Wed Oct 29 
21:05:03 2014
@@ -22,6 +22,9 @@
   <body>
 
   <release version="4.1" date="TBD" description="">
+    <action issue="COLLECTIONS-536" dev="tn" type="fix" due-to="Tagir Valeev">
+      Improved check for null input in "MapUtils#putAll(Map, Object[])".
+    </action>
     <action issue="COLLECTIONS-534" dev="tn" type="fix" due-to="Oswaldo Olivo">
       Added clarifying javadoc wrt runtime complexity of 
"CollectionBag#retainAll".
     </action>

Modified: 
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java?rev=1635303&r1=1635302&r2=1635303&view=diff
==============================================================================
--- 
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java
 (original)
+++ 
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java
 Wed Oct 29 21:05:03 2014
@@ -1147,7 +1147,9 @@ public class MapUtils {
      */
     @SuppressWarnings("unchecked") // As per Javadoc throws CCE for invalid 
array contents
     public static <K, V> Map<K, V> putAll(final Map<K, V> map, final Object[] 
array) {
-        map.size();  // force NPE
+        if (map == null) {
+            throw new NullPointerException("The map must not be null");
+        }
         if (array == null || array.length == 0) {
             return map;
         }


Reply via email to