[COLLECTIONS-536] Improved null check. Thanks to Tagir Valeev.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1635303 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a3503a1b56
commit
b9284992ea
|
@ -22,6 +22,9 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<release version="4.1" date="TBD" description="">
|
<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">
|
<action issue="COLLECTIONS-534" dev="tn" type="fix" due-to="Oswaldo Olivo">
|
||||||
Added clarifying javadoc wrt runtime complexity of "CollectionBag#retainAll".
|
Added clarifying javadoc wrt runtime complexity of "CollectionBag#retainAll".
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -1147,7 +1147,9 @@ public class MapUtils {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked") // As per Javadoc throws CCE for invalid array contents
|
@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) {
|
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) {
|
if (array == null || array.length == 0) {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue