You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2003/05/09 20:33:27 UTC

cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/decorators FixedSizeMap.java UnmodifiableMap.java PredicatedMap.java AbstractMapDecorator.java

scolebourne    2003/05/09 11:33:27

  Modified:    collections/src/java/org/apache/commons/collections/decorators
                        FixedSizeMap.java UnmodifiableMap.java
                        PredicatedMap.java AbstractMapDecorator.java
  Log:
  Ensure map putAll() method does not recurse
  
  Revision  Changes    Path
  1.2       +6 -6      jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/FixedSizeMap.java
  
  Index: FixedSizeMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/FixedSizeMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FixedSizeMap.java	9 May 2003 16:42:35 -0000	1.1
  +++ FixedSizeMap.java	9 May 2003 18:33:27 -0000	1.2
  @@ -112,13 +112,13 @@
           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() {
  
  
  
  1.2       +3 -3      jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/UnmodifiableMap.java
  
  Index: UnmodifiableMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/UnmodifiableMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UnmodifiableMap.java	9 May 2003 16:42:36 -0000	1.1
  +++ UnmodifiableMap.java	9 May 2003 18:33:27 -0000	1.2
  @@ -103,7 +103,7 @@
           throw new UnsupportedOperationException();
       }
   
  -    public void putAll(Map map) {
  +    public void putAll(Map mapToCopy) {
           throw new UnsupportedOperationException();
       }
   
  
  
  
  1.2       +5 -5      jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/PredicatedMap.java
  
  Index: PredicatedMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/PredicatedMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PredicatedMap.java	9 May 2003 16:42:36 -0000	1.1
  +++ PredicatedMap.java	9 May 2003 18:33:27 -0000	1.2
  @@ -136,15 +136,15 @@
           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() {
  
  
  
  1.2       +4 -4      jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/AbstractMapDecorator.java
  
  Index: AbstractMapDecorator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/decorators/AbstractMapDecorator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractMapDecorator.java	9 May 2003 16:38:16 -0000	1.1
  +++ AbstractMapDecorator.java	9 May 2003 18:33:27 -0000	1.2
  @@ -142,8 +142,8 @@
           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) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org