You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2009/02/16 20:36:02 UTC

[jira] Created: (COLLECTIONS-319) IteratorUtils.getIterator(Object obj) performs redundant null check

IteratorUtils.getIterator(Object obj) performs redundant null check
-------------------------------------------------------------------

                 Key: COLLECTIONS-319
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-319
             Project: Commons Collections
          Issue Type: Bug
          Components: Collection
            Reporter: Sebb
            Priority: Minor


IteratorUtils.getIterator(Object obj) performs redundant null check:

{code}
        if (obj == null) {
            return emptyIterator();            
...
        } else if (obj != null && obj.getClass().isArray()) {
            return new ArrayIterator(obj);
{code}

obj cannot be null at that point, so the check can be removed. 
[This will also prevent a false positive in Eclipse which later says tha obj may be null]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COLLECTIONS-319) IteratorUtils.getIterator(Object obj) performs redundant null check

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COLLECTIONS-319?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated COLLECTIONS-319:
--------------------------------------

    Fix Version/s:     (was: 3.4)
                   3.3

> IteratorUtils.getIterator(Object obj) performs redundant null check
> -------------------------------------------------------------------
>
>                 Key: COLLECTIONS-319
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-319
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Collection
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 3.3
>
>
> IteratorUtils.getIterator(Object obj) performs redundant null check:
> {code}
>         if (obj == null) {
>             return emptyIterator();            
> ...
>         } else if (obj != null && obj.getClass().isArray()) {
>             return new ArrayIterator(obj);
> {code}
> obj cannot be null at that point, so the check can be removed. 
> [This will also prevent a false positive in Eclipse which later says tha obj may be null]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (COLLECTIONS-319) IteratorUtils.getIterator(Object obj) performs redundant null check

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COLLECTIONS-319?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed COLLECTIONS-319.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 3.4

svn ci -m "Fixing unnecessary null check in IteratorUtils per COLLECTIONS-319" src
Sending        src/java/org/apache/commons/collections/IteratorUtils.java
Transmitting file data .
Committed revision 767766.

> IteratorUtils.getIterator(Object obj) performs redundant null check
> -------------------------------------------------------------------
>
>                 Key: COLLECTIONS-319
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-319
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Collection
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 3.4
>
>
> IteratorUtils.getIterator(Object obj) performs redundant null check:
> {code}
>         if (obj == null) {
>             return emptyIterator();            
> ...
>         } else if (obj != null && obj.getClass().isArray()) {
>             return new ArrayIterator(obj);
> {code}
> obj cannot be null at that point, so the check can be removed. 
> [This will also prevent a false positive in Eclipse which later says tha obj may be null]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.