diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 40f22aaf2..82942c3c1 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -22,6 +22,10 @@ + + "MultiKeyMap" was throwing a "NullPointerException" for various operations + if two key arguments have been used and the second was "null". + Updated code example for "PredicatedList". diff --git a/src/main/java/org/apache/commons/collections4/map/MultiKeyMap.java b/src/main/java/org/apache/commons/collections4/map/MultiKeyMap.java index ee8d4f127..4c9a993e2 100644 --- a/src/main/java/org/apache/commons/collections4/map/MultiKeyMap.java +++ b/src/main/java/org/apache/commons/collections4/map/MultiKeyMap.java @@ -249,7 +249,7 @@ public class MultiKeyMap extends AbstractMapDecorator extends AbstractIterableMapTest map = new MultiKeyMap(); + map.put("a", null, "value1"); + map.put("b", null, "value2"); + map.put("c", null, "value3"); + map.put("a", "z", "value4"); + map.put("a", null, "value5"); + map.put(null, "a", "value6"); + map.put(null, null, "value7"); + + assertEquals(6, map.size()); + assertEquals("value5", map.get("a", null)); + assertEquals("value4", map.get("a", "z")); + assertEquals("value6", map.get(null, "a")); + } + public void testMultiKeyRemove() { final MultiKey[] keys = getMultiKeyKeys(); final V[] values = getSampleValues();