Index: src/java/org/apache/commons/collections/CollectionUtils.java =================================================================== --- src/java/org/apache/commons/collections/CollectionUtils.java (revision 657369) +++ src/java/org/apache/commons/collections/CollectionUtils.java (working copy) @@ -941,13 +941,15 @@ * Note: This method is named to avoid clashing with * {@link #isEmpty(Collection)}. * - * @param object the object to get the size of, not null - * @return true if empty - * @throws IllegalArgumentException thrown if object is not recognised or null + * @param object the object to get the size of, may be null + * @return true if empty or null + * @throws IllegalArgumentException thrown if object is not recognised * @since Commons Collections 3.2 */ public static boolean sizeIsEmpty(Object object) { - if (object instanceof Collection) { + if (object == null) { + return true; + } else if (object instanceof Collection) { return ((Collection) object).isEmpty(); } else if (object instanceof Map) { return ((Map) object).isEmpty(); @@ -957,8 +959,6 @@ return ((Iterator) object).hasNext() == false; } else if (object instanceof Enumeration) { return ((Enumeration) object).hasMoreElements() == false; - } else if (object == null) { - throw new IllegalArgumentException("Unsupported object type: null"); } else { try { return Array.getLength(object) == 0; Index: src/test/org/apache/commons/collections/TestCollectionUtils.java =================================================================== --- src/test/org/apache/commons/collections/TestCollectionUtils.java (revision 657369) +++ src/test/org/apache/commons/collections/TestCollectionUtils.java (working copy) @@ -802,6 +802,9 @@ } //----------------------------------------------------------------------- + public void testSizeIsEmpty_Null() { + assertEquals(true, CollectionUtils.sizeIsEmpty(null)); + } public void testSizeIsEmpty_List() { List list = new ArrayList(); assertEquals(true, CollectionUtils.sizeIsEmpty(list)); @@ -856,10 +859,6 @@ } public void testSizeIsEmpty_Other() { try { - CollectionUtils.sizeIsEmpty(null); - fail("Expecting IllegalArgumentException"); - } catch (IllegalArgumentException ex) {} - try { CollectionUtils.sizeIsEmpty("not a list"); fail("Expecting IllegalArgumentException"); } catch (IllegalArgumentException ex) {}