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 207377

Summary: [71cat] Closing project causes its re-scanning.
Product: java Reporter: Petr Cyhelsky <cyhelsky>
Component: ProjectAssignee: Tomas Zezula <tzezula>
Status: RESOLVED FIXED    
Severity: normal CC: dstrupl, jglick, muellermi
Priority: P3    
Version: 7.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 184362
Attachments: stacktrace

Description Petr Cyhelsky 2012-01-17 08:24:10 UTC
Build: NetBeans IDE Dev (Build 201201150601)
VM: Java HotSpot(TM) Client VM, 22.0-b10, Java(TM) SE Runtime Environment, 1.7.0_02-b13
OS: Linux

User Comments:
muellermi: just to provide information

cyhelsky: scan was initiated by closing all projects - imho there should be no scan in this case




Stacktrace: 
java.lang.Exception: Scan canceled.
   at java.lang.Thread.getStackTrace(Thread.java:1567)
   at org.netbeans.modules.parsing.impl.indexing.LogContext.create(LogContext.java:74)
   at org.netbeans.modules.parsing.impl.indexing.LogContext.create(LogContext.java:67)
   at org.netbeans.modules.parsing.impl.indexing.PathRegistry.scheduleFirer(PathRegistry.java:813)
   at org.netbeans.modules.parsing.impl.indexing.PathRegistry.resetCacheAndFire(PathRegistry.java:808)
   at org.netbeans.modules.parsing.impl.indexing.PathRegistry.access$500(PathRegistry.java:84)
Comment 1 Petr Cyhelsky 2012-01-17 08:24:13 UTC
Created attachment 114954 [details]
stacktrace
Comment 2 David Strupl 2012-01-19 14:57:47 UTC
When closing project the method

org.netbeans.modules.project.ui.ProjectUtilities.storeProjectOpenFiles(ProjectUtilities.java:496)

triggers saving of project files and 

org.netbeans.modules.java.api.common.SourceRoots$ProjectMetadataListener.configurationXmlChanged(SourceRoots.java:561)

listens and through resetCaches triggers change in project roots.
Comment 3 Jesse Glick 2012-01-19 21:03:44 UTC
Perhaps resetCaches could check whether there is an actual change in sourceRootURLs and/or sourceRootProperties before refiring an event. What is the actual query triggering indexer rescan - Sources, SourceForBinaryQuery.Result, ClassPathImplementation (for SOURCE), or some combination?
Comment 4 Tomas Zezula 2012-01-19 21:21:53 UTC
The SR fired as the event come from projectXMLChanged.
To verify that the sourceRootProperties has changed the resetCaches will need to parse the projectXML, this may be problematic if lots of event comes.
When only property changes the SR fire only if changed property is a source root property.
But the change come form private.xml, ignoring the event when ev.getPath() == APH.PRIVATE_XML_PATH may be enough. I will try.
Comment 5 Tomas Zezula 2012-01-20 13:11:09 UTC
fixed jet-main b9fc9222ea3c
Comment 6 Quality Engineering 2012-01-25 16:31:23 UTC
Integrated into 'main-golden', will be available in build *201201250600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b9fc9222ea3c
User: Tomas Zezula <tzezula@netbeans.org>
Log: #207377:[71cat] Closing project causes its re-scanning.