commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COLLECTIONS-401) Inconsistent Javadoc comment and code in removeAll(Collection<E>, Collection<?>) in org.apache.commons.collections.ListUtils
Date Wed, 20 Jun 2012 17:24:43 GMT

    [ https://issues.apache.org/jira/browse/COLLECTIONS-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397653#comment-13397653
] 

Thomas Neidhart commented on COLLECTIONS-401:
---------------------------------------------

Can you be a bit more precise?

Looking at the code of ListUtils, I do not see that retainAll is called. In fact doing a reference
check of ListUtils.retainAll shows that it is only called by CollectionUtils.retainAll (and
some test class).
                
> Inconsistent Javadoc comment and code in removeAll(Collection<E>, Collection<?>)
in org.apache.commons.collections.ListUtils
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COLLECTIONS-401
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-401
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Collection
>    Affects Versions: 3.2.1
>            Reporter: SHIN HWEI TAN
>              Labels: javadoc
>   Original Estimate: 0.05h
>  Remaining Estimate: 0.05h
>
> 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)".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message