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 240829 - Parsing result has wrong file object
Summary: Parsing result has wrong file object
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 8.0
Hardware: PC Solaris
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-22 16:04 UTC by Alexander Simon
Modified: 2014-01-28 03:05 UTC (History)
1 user (show)

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 Alexander Simon 2014-01-22 16:04:24 UTC
Steps to reproduce:
- create C/C++ sample project "Welcome"
- open welcome.cc source file
- put cursor inside main function
- pop up menu Navigate->View Macro Expansion
- put cursor inside macro expansion view
- unselect top button of macro expansion view (sync caret)
- move cursor inside macro expansion view
Parsing API does not update file object in Source.

To see bug set breakpoint in DataObject.find() method on statement:
"throw new FileStateInvalidException(fo.toString());"

As result all ParserResultTask cannot find document by:
parserResult.getSnapshot().getSource().getDocument(false)
Comment 1 Alexander Simon 2014-01-22 16:09:21 UTC
Task factory in module cnd.navigation, class org.netbeans.modules.cnd.navigation.macroview.MacroExpansionCaretAwareFactory
Comment 2 Tomas Zezula 2014-01-25 08:12:37 UTC
The Source is bound to FileObject.
When the FileObject is deleted (becomes invalid) the Source is invalid as well.
The Source.create() will return a new one.
So the fact that the:

org.openide.loaders.DataObject.find(DataObject.java:555)
org.netbeans.modules.parsing.api.Source.getDocument(Source.java:259)
org.netbeans.modules.parsing.impl.event.EventSupport$DocListener.propertyChange(EventSupport.java:286)
org.openide.util.WeakListenerImpl$PropertyChange.propertyChange(WeakListenerImpl.java:197)
java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
org.openide.text.CloneableEditorSupport.firePropertyChange(CloneableEditorSupport.java:483)
org.openide.text.CloneableEditorSupport.fireDocumentChange(CloneableEditorSupport.java:1741)
org.openide.text.DocumentOpenClose$DocumentClose.run(DocumentOpenClose.java:1012)

clears the Document from the Source is correct, as the Source is already invalid.

The problem is that the invalid Source is used for ParserResultTasks.
Comment 3 Tomas Zezula 2014-01-25 09:36:27 UTC
The problems is caused by strange change of the FileObject (memory FO) in the Document.
When I click the sync caret button, the parsing.api correctly gets an event DataObject.PROP_VALID (the FileObject in invalid) unfortunately it does not get DataObject.PROP_VALID when the DataObject becomes valid again. I've verified in debugger that the Document's FileObject has changed to valid one and also DataObject is valid.
Comment 4 Tomas Zezula 2014-01-25 10:46:28 UTC
Fixed jet-main f16048c0272a
Comment 5 Quality Engineering 2014-01-28 03:05:03 UTC
Integrated into 'main-silver', will be available in build *201401280001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f16048c0272a
User: Tomas Zezula <tzezula@netbeans.org>
Log: #240829:Parsing result has wrong file object