You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by pj...@apache.org on 2002/08/17 23:10:46 UTC

cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections BagUtils.java CollectionUtils.java ListUtils.java MapUtils.java SetUtils.java

pjack       2002/08/17 14:10:46

  Modified:    collections/src/java/org/apache/commons/collections
                        BagUtils.java CollectionUtils.java ListUtils.java
                        MapUtils.java SetUtils.java
  Log:
  More IllegalArgument checks to decorators.
  
  Revision  Changes    Path
  1.4       +7 -4      jakarta-commons/collections/src/java/org/apache/commons/collections/BagUtils.java
  
  Index: BagUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/BagUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BagUtils.java	13 Aug 2002 00:49:59 -0000	1.3
  +++ BagUtils.java	17 Aug 2002 21:10:46 -0000	1.4
  @@ -182,6 +182,9 @@
   
           public BoundedBag(Bag bag, int maxSize) {
               super(bag);
  +            if (maxSize < 0) {
  +                throw new IllegalArgumentException("maxSize must be nonnegative.");
  +            }
               this.maxSize = maxSize;
           }
   
  
  
  
  1.13      +7 -4      jakarta-commons/collections/src/java/org/apache/commons/collections/CollectionUtils.java
  
  Index: CollectionUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/CollectionUtils.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CollectionUtils.java	17 Aug 2002 11:38:35 -0000	1.12
  +++ CollectionUtils.java	17 Aug 2002 21:10:46 -0000	1.13
  @@ -753,6 +753,9 @@
   
           public BoundedCollection(Collection c, int maxSize) {
               super(c);
  +            if (maxSize < 0) {
  +                throw new IllegalArgumentException("maxSize must be nonnegative.");
  +            }
               this.maxSize = maxSize;
           }
   
  
  
  
  1.9       +9 -3      jakarta-commons/collections/src/java/org/apache/commons/collections/ListUtils.java
  
  Index: ListUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ListUtils.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ListUtils.java	15 Aug 2002 20:09:37 -0000	1.8
  +++ ListUtils.java	17 Aug 2002 21:10:46 -0000	1.9
  @@ -364,6 +364,9 @@
   
           public BoundedList(List list, int maxSize) {
               super(list);
  +            if (maxSize < 0) {
  +                throw new IllegalArgumentException("maxSize must be nonnegative.");
  +            }
               this.maxSize = maxSize;
           }
   
  @@ -444,6 +447,9 @@
   
           public LazyList(List list, Factory factory) {
               super(list);
  +            if (factory == null) {
  +                throw new IllegalArgumentException("factory may not be null");
  +            }
               this.factory = factory;
           }
   
  
  
  
  1.10      +27 -3     jakarta-commons/collections/src/java/org/apache/commons/collections/MapUtils.java
  
  Index: MapUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/MapUtils.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MapUtils.java	15 Aug 2002 20:09:37 -0000	1.9
  +++ MapUtils.java	17 Aug 2002 21:10:46 -0000	1.10
  @@ -736,6 +736,15 @@
   
           public PredicatedMap(Map map, Predicate keyPred, Predicate valuePred) {
               super(map);
  +            if (map == null) {
  +                throw new IllegalArgumentException("map may not be null.");
  +            }
  +            if (keyPred == null) {
  +                throw new IllegalArgumentException("keyPred may not be null.");
  +            }
  +            if (valuePred == null) {
  +                throw new IllegalArgumentException("valuePred may not be null.");
  +            }
               this.keyPredicate = keyPred;
               this.valuePredicate = valuePred;
               Iterator iter = map.entrySet().iterator();
  @@ -856,6 +865,12 @@
   
           public BoundedMap(Map map, int maxSize) {
               super(map);
  +            if (map == null) {
  +                throw new IllegalArgumentException("map may not be null.");
  +            }
  +            if (maxSize < 0) {
  +                throw new IllegalArgumentException("maxSize must be nonnegative.");
  +            }
               this.maxSize = maxSize;
           }
   
  @@ -886,6 +901,9 @@
   
           public FixedSizeMap(Map map) {
               super(map);
  +            if (map == null) {
  +                throw new IllegalArgumentException("map may not be null.");
  +            }
           }
   
   
  @@ -916,6 +934,12 @@
   
           public LazyMap(Map map, Factory factory) {
               super(map);
  +            if (map == null) {
  +                throw new IllegalArgumentException("map may not be null.");
  +            }
  +            if (factory == null) {
  +                throw new IllegalArgumentException("factory may not be null.");
  +            }
               this.factory = factory;
           }
   
  
  
  
  1.4       +7 -4      jakarta-commons/collections/src/java/org/apache/commons/collections/SetUtils.java
  
  Index: SetUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/SetUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SetUtils.java	13 Aug 2002 00:49:59 -0000	1.3
  +++ SetUtils.java	17 Aug 2002 21:10:46 -0000	1.4
  @@ -103,6 +103,9 @@
   
           public BoundedSet(Set set, int maxSize) {
               super(set);
  +            if (maxSize < 0) {
  +                throw new IllegalArgumentException("maxSize must be nonnegative.");
  +            }
               this.maxSize = maxSize;
           }
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>