Hello list,

In my opinion it would be good if SynchronizedCollection checked in its protected Constructor which takes a collection and a lock, if the lock were actually null (as advertised in the javadoc).

I have added a unidiff  (Against collections-3.2) to address this issue

Robert Ribnitz

--- 
../commons-collections-3.2-src-orig/./src/java/org/apache/commons/collections/collection/SynchronizedCollection.java
        2006-05-14 22:39:40.000000000 +0200
+++ 
./src/java/org/apache/commons/collections/collection/SynchronizedCollection.java
    2006-08-20 14:45:17.574110536 +0200
@@ -79,12 +79,16 @@
      * 
      * @param collection  the collection to decorate, must not be null
      * @param lock  the lock object to use, must not be null
-     * @throws IllegalArgumentException if the collection is null
+     * @throws IllegalArgumentException if either the collection or 
+     * the lock are null
      */
     protected SynchronizedCollection(Collection collection, Object lock) {
         if (collection == null) {
             throw new IllegalArgumentException("Collection must not be null");
         }
+        if (lock == null) {
+               throw new IllegalArgumentException("Lock must not be null");
+        }
         this.collection = collection;
         this.lock = lock;
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to