diff --git a/src/main/java/org/apache/commons/collections/map/DefaultedMap.java b/src/main/java/org/apache/commons/collections/map/DefaultedMap.java index 6f4a4d793..bf5907c00 100644 --- a/src/main/java/org/apache/commons/collections/map/DefaultedMap.java +++ b/src/main/java/org/apache/commons/collections/map/DefaultedMap.java @@ -136,9 +136,8 @@ public class DefaultedMap extends AbstractMapDecorator implements Se } /** - * Constructs a new empty DefaultedMap that decorates - * a HashMap. - *

+ * Constructs a new empty DefaultedMap that decorates a HashMap. + * * @param defaultValueTransformer transformer to use to generate missing values. */ public DefaultedMap(Transformer defaultValueTransformer) { @@ -151,10 +150,12 @@ public class DefaultedMap extends AbstractMapDecorator implements Se * @param map the map to decorate, must not be null * @param defaultValueTransformer the value transformer to use * @throws IllegalArgumentException if map or transformer is null - * TODO does not check for null transformer: fix code or Javadoc */ protected DefaultedMap(Map map, Transformer defaultValueTransformer) { super(map); + if (defaultValueTransformer == null) { + throw new IllegalArgumentException("transformer must not be null"); + } this.value = defaultValueTransformer; }