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 114182 - An exception on an UML action
Summary: An exception on an UML action
Status: CLOSED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P2 blocker (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-30 01:01 UTC by Viktor Lapitski
Modified: 2007-11-08 18:25 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 Viktor Lapitski 2007-08-30 01:01:32 UTC
Hi!

we have an IZ 113914 where in response to delete action on an UML project 
user sometimes gets an exception. The control flow shown by the exception is :

1. UML module calls delete() on a FileObject of a project directory

2. an update event is being delivered through netbeans loaders and 
   filesystems subsystems to various listeners 

2.1 among the listeners is a one belonging to cnd module
org.netbeans.modules.cnd.modelimpl.platform.ModelSupport$FileChangeListener

3. the listener calls getNodeDelegate() on a DataObject 
(corresponding to a file in the directory being deleted) which sometimes 
happens to be invalid, that causes the exception to be thrown.

Unfortunately the UML team doesn't have the control over 
the situation that happens after the call to delete() on a pretty 
valid FileObject. 

Thus i'm filing this issue. It is filed as a P2 not because 
i would see it as a P2 bug in the cnd code - after all checking 
for validity of any and all object returned by Netbeans API 
would be an overkill. 
The P2 status just reflects the urgency we need your decision here 
(we're going into beta1 next week and beta2 about a month later), 
ie. would you consider adding a DataObject.isValid() check before 
calling DataObject.getNodeDelegate(), something like this :

*** cnd/modelimpl/src/org/netbeans/modules/cnd/modelimpl/platform/ModelSupport.j
ava_orig        Wed Aug 29 16:17:30 2007
--- cnd/modelimpl/src/org/netbeans/modules/cnd/modelimpl/platform/ModelSupport.j
ava     Wed Aug 29 16:18:44 2007
***************
*** 607,612 ****
--- 607,614 ----
          // TODO: need to change implementation when ataObject will contain cor
rect cookie
          private void editStart(DataObject curObj) {

+           if (! curObj.isValid())
+               return;
            NativeFileItemSet set = (NativeFileItemSet) curObj.getNodeDelegate()
.getLookup().lookup(NativeFileItemSet.class);

            if( set != null && ! set.isEmpty() ) {



Thanks,
Viktor.

======= the exception ===========
java.lang.IllegalStateException: The data object MasterFileObject@1d53bc5[E:/HydraProjs/20070827-b2819/UMLProject1/Class
Diagram 1_1188238485260.etlp] is invalid; you may not call getNodeDelegate on it any more; see #17020 and please fix
your code
	at org.openide.loaders.DataObject.getNodeDelegate(DataObject.java:245)
	at org.netbeans.modules.cnd.modelimpl.platform.ModelSupport$FileChangeListener.editStart(ModelSupport.java:610)
	at org.netbeans.modules.cnd.modelimpl.platform.ModelSupport$FileChangeListener.stateChanged(ModelSupport.java:711)
	at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:101)
	at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:87)
	at org.openide.loaders.DataObject$ModifiedRegistry.remove(DataObject.java:1138)
	at java.util.Collections$SynchronizedCollection.remove(Collections.java:1580)
	at org.openide.loaders.DataObject.setModified(DataObject.java:413)
	at org.openide.loaders.DataObject.markInvalid0(DataObject.java:190)
	at org.openide.loaders.MultiDataObject.notifyFileDeleted(MultiDataObject.java:1170)
	at org.openide.loaders.DataObjectPool$FSListener.fileDeleted(DataObjectPool.java:607)
	at org.openide.filesystems.FCLSupport.dispatchEvent(FCLSupport.java:84)
	at org.openide.filesystems.FileObject$ED.dispatch(FileObject.java:916)
	at org.openide.filesystems.EventControl.invokeDispatchers(EventControl.java:181)
	at org.openide.filesystems.EventControl.exitAtomicAction(EventControl.java:155)
	at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:100)
	at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:477)
	at org.netbeans.modules.masterfs.MasterFileObject$AtomicAction.delete(MasterFileObject.java:1036)
	at org.netbeans.modules.masterfs.MasterFileObject.delete(MasterFileObject.java:463)
	at org.openide.filesystems.FileObject.delete(FileObject.java:334)
	at
org.netbeans.modules.uml.project.ui.nodes.UMLPhysicalViewProvider$UMLLogicalViewRootNode.destroy(UMLPhysicalViewProvider.java:402)
	at org.netbeans.modules.uml.project.UMLActionProvider.invokeAction(UMLActionProvider.java:72)
	at org.netbeans.modules.project.ui.actions.ProjectAction.actionPerformed(ProjectAction.java:94)
	at org.netbeans.modules.project.ui.actions.LookupSensitiveAction.actionPerformed(LookupSensitiveAction.java:139)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1170)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1211)
	at java.awt.Component.processMouseEvent(Component.java:6038)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
	at java.awt.Component.processEvent(Component.java:5803)
	at java.awt.Container.processEvent(Container.java:2058)
	at java.awt.Component.dispatchEventImpl(Component.java:4410)
	at java.awt.Container.dispatchEventImpl(Container.java:2116)
	at java.awt.Component.dispatchEvent(Component.java:4240)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
	at java.awt.Container.dispatchEventImpl(Container.java:2102)
	at java.awt.Window.dispatchEventImpl(Window.java:2429)
	at java.awt.Component.dispatchEvent(Component.java:4240)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Comment 1 Vladimir Voskresensky 2007-08-30 06:36:12 UTC
thanks for investigation!
Comment 2 Vladimir Voskresensky 2007-08-30 06:41:41 UTC
fixed:

cvs log:
Checking in ModelSupport.java;
/cvs/cnd/modelimpl/src/org/netbeans/modules/cnd/modelimpl/platform/ModelSupport.java,v  <--  ModelSupport.java
new revision: 1.23; previous revision: 1.22
done
Comment 3 Viktor Lapitski 2007-08-30 07:33:50 UTC
thank you, we do appreciate it.