diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 861c47e7c..e91e364c8 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -22,6 +22,9 @@ + + Improved check for null input in "MapUtils#putAll(Map, Object[])". + Added clarifying javadoc wrt runtime complexity of "CollectionBag#retainAll". diff --git a/src/main/java/org/apache/commons/collections4/MapUtils.java b/src/main/java/org/apache/commons/collections4/MapUtils.java index bfd03d803..c65bf089b 100644 --- a/src/main/java/org/apache/commons/collections4/MapUtils.java +++ b/src/main/java/org/apache/commons/collections4/MapUtils.java @@ -1147,7 +1147,9 @@ public class MapUtils { */ @SuppressWarnings("unchecked") // As per Javadoc throws CCE for invalid array contents public static Map putAll(final Map 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; }