This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 257181 - ExplorerManager#setSelectedNodes(): Error in validation code for nodes not under root
Summary: ExplorerManager#setSelectedNodes(): Error in validation code for nodes not un...
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Jan Peska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-16 16:58 UTC by sjaenick
Modified: 2015-12-18 12:21 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sjaenick 2015-12-16 16:58:36 UTC
If the setSelectedNodes() method is invoked with a node not existing below the
current root context, the checkAndSet() method of the inner class creates a new 
list instance for valid nodes and copies over previously validated nodes;
however, the copy loop uses the wrong index variable (i instead of j), thus 
repeatedly adding the same node:


               if (!isUnderRoot(value[i])) {
                   if (validNodes == null) {
                       validNodes = new ArrayList<Node>(value.length);
                       for (int j = 0; j < i; j++) {
---->                       validNodes.add(value[i]);   <-----
                       }
                   }

(starting at line 251 in 8.1)