Hi,

jira issue IVY-590 reports a NullPointerException which is caused by the 
following code (selected can be null):

        public EvictionData(String rootModuleConf, IvyNode parent, 
ConflictManager conflictManager,
                Collection selected) {
            this.rootModuleConf = rootModuleConf;
            this.parent = parent;
            this.conflictManager = conflictManager;
            this.selected = selected;
            for (Iterator iter = selected.iterator(); iter.hasNext();) {
                Object o = (Object) iter.next();
                if (!(o instanceof IvyNode)) {
                    throw new IllegalArgumentException(
                            "selected nodes must be instance of IvyNode. Found: 
"
                                    + o.getClass().getName());
                }
            }
        }


Several patches have been contributed to fix this NPE by checking the selected 
parameter for null before entering the for-loop. However, I would like to 
remove this for loop from the code, since the collection always contains 
IvyNodes. 

Does someone has an idea why this instanceof-check has been added there?

regards,
Maarten




       
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. 
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469

Reply via email to