Ensure map putAll() method does not recurse

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131056 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-05-09 18:33:27 +00:00
parent c284d5a192
commit 5535332edc
4 changed files with 18 additions and 18 deletions

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/AbstractMapDecorator.java,v 1.1 2003/05/09 16:38:16 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/AbstractMapDecorator.java,v 1.2 2003/05/09 18:33:27 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -77,7 +77,7 @@ import java.util.Set;
* you might want that loophole, so this class is kept simple.</p>
*
* @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/05/09 16:38:16 $
* @version $Revision: 1.2 $ $Date: 2003/05/09 18:33:27 $
*
* @author Daniel Rall
* @author Stephen Colebourne
@ -142,8 +142,8 @@ public abstract class AbstractMapDecorator implements Map {
return map.put(key, value);
}
public void putAll(Map map) {
map.putAll(map);
public void putAll(Map mapToCopy) {
map.putAll(mapToCopy);
}
public Object remove(Object key) {

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/FixedSizeMap.java,v 1.1 2003/05/09 16:42:35 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/FixedSizeMap.java,v 1.2 2003/05/09 18:33:27 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -77,7 +77,7 @@ import java.util.Set;
* is not always unsupported.
*
* @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/05/09 16:42:35 $
* @version $Revision: 1.2 $ $Date: 2003/05/09 18:33:27 $
*
* @author Stephen Colebourne
* @author Paul Jack
@ -112,13 +112,13 @@ public class FixedSizeMap extends AbstractMapDecorator implements Map {
return map.put(key, value);
}
public void putAll(Map map) {
for (Iterator it = map.keySet().iterator(); it.hasNext(); ) {
if (map.containsKey(it.next()) == false) {
public void putAll(Map mapToCopy) {
for (Iterator it = mapToCopy.keySet().iterator(); it.hasNext(); ) {
if (mapToCopy.containsKey(it.next()) == false) {
throw new IllegalArgumentException("Cannot put new key/value pair - Map is fixed size");
}
}
map.putAll(map);
map.putAll(mapToCopy);
}
public void clear() {

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/PredicatedMap.java,v 1.1 2003/05/09 16:42:36 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/PredicatedMap.java,v 1.2 2003/05/09 18:33:27 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -72,7 +72,7 @@ import org.apache.commons.collections.Predicate;
* is thrown.
*
* @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/05/09 16:42:36 $
* @version $Revision: 1.2 $ $Date: 2003/05/09 18:33:27 $
*
* @author Stephen Colebourne
* @author Paul Jack
@ -136,15 +136,15 @@ public class PredicatedMap extends AbstractMapDecorator {
return map.put(key, value);
}
public void putAll(Map map) {
Iterator it = map.entrySet().iterator();
public void putAll(Map mapToCopy) {
Iterator it = mapToCopy.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Object key = entry.getKey();
Object value = entry.getValue();
validate(key, value);
}
map.putAll(map);
map.putAll(mapToCopy);
}
public Set entrySet() {

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/UnmodifiableMap.java,v 1.1 2003/05/09 16:42:36 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/UnmodifiableMap.java,v 1.2 2003/05/09 18:33:27 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -68,7 +68,7 @@ import java.util.Set;
* to ensure it can't be altered.
*
* @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/05/09 16:42:36 $
* @version $Revision: 1.2 $ $Date: 2003/05/09 18:33:27 $
*
* @author Stephen Colebourne
*/
@ -103,7 +103,7 @@ public class UnmodifiableMap extends AbstractMapDecorator {
throw new UnsupportedOperationException();
}
public void putAll(Map map) {
public void putAll(Map mapToCopy) {
throw new UnsupportedOperationException();
}