Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
3.2.1
-
None
Description
The Javadoc comment below states that the method "throws NullPointerException if either parameter is null".
/*......
- @throws NullPointerException if either parameter is null
*/
public static <E> List<E> removeAll(Collection<E> collection, Collection<?> remove) { .. }However, when called with two null collections (i.e., "removeAll((Collection)null, (Collection)null)"), the method executes normally without throwing any exception.
Suggested Fixes:
1. Add code "if (collection == null) throw NullPointerException();" at the beginning of the method body.
or
2. Remove "@throws NullPointerException if either parameter is null" from the Javadoc.
or
3. Change "@throws NullPointerException if either parameter is null" to "@throws NullPointerException if the first collection is null or (the first collection is non-empty and the second collection is null)".