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 91081 - Node.getParentNode() throws ClassCastException
Summary: Node.getParentNode() throws ClassCastException
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 5.x
Hardware: Macintosh All
: P3 blocker (vote)
Assignee: Petr Nejedly
URL:
Keywords: RANDOM, THREAD
Depends on:
Blocks:
 
Reported: 2006-12-14 15:51 UTC by santhosh
Modified: 2008-12-22 10:47 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 santhosh 2006-12-14 15:51:29 UTC
In my application, which is build on top of NB Platform 5.0,

I encountered a ClassCastException some time in Node.getParentNode();
But there is no specific steps found to reproduce this;

May be you have some Idea on this;
Here is the stacktrace:

java.lang.ClassCastException: org.openide.nodes.ChildrenArray
	at org.openide.nodes.Node.getParentChildren(Node.java:285)
	at org.openide.nodes.Node.getParentNode(Node.java:463)
	at com.fiorano.openide.dmi.DMIValidator.getDMIValidator(DMIValidator.java:165)
	at com.fiorano.openide.nodes.DMIChildNode$1.propertyChange(DMIChildNode.java:213)
	at org.openide.nodes.Node.fireOwnPropertyChange(Node.java:1117)
	at org.openide.nodes.Node.fireParentNodeChange(Node.java:1069)
	at org.openide.nodes.Children.justComputeNodes(Children.java:691)
	at org.openide.nodes.ChildrenArray.nodes(ChildrenArray.java:64)
	at org.openide.nodes.Children.getNodes(Children.java:350)
	at org.openide.explorer.view.VisualizerNode.getChildren(VisualizerNode.java:215)
	at org.openide.explorer.view.VisualizerNode.children(VisualizerNode.java:262)
	at
com.fiorano.openide.explorer.model.ContextNodeTreeModel.getChildCount(ContextNodeTreeModel.java:29)
	at
javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1461)
	at
javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1270)
	at
javax.swing.tree.VariableHeightLayoutCache.ensurePathIsExpanded(VariableHeightLayoutCache.java:966)
	at
javax.swing.tree.VariableHeightLayoutCache.setExpandedState(VariableHeightLayoutCache.java:164)
	at
javax.swing.plaf.basic.BasicTreeUI.updateExpandedDescendants(BasicTreeUI.java:1556)
	at javax.swing.plaf.basic.BasicTreeUI$Handler.treeExpanded(BasicTreeUI.java:3645)
	at javax.swing.JTree.fireTreeExpanded(JTree.java:2235)
	at javax.swing.JTree.setExpandedState(JTree.java:3006)
	at javax.swing.JTree.expandPath(JTree.java:1742)
	at javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(BasicTreeUI.java:2189)
	at
javax.swing.plaf.basic.BasicTreeUI.handleExpandControlClick(BasicTreeUI.java:2176)
	at
javax.swing.plaf.basic.BasicTreeUI.checkForClickInExpandControl(BasicTreeUI.java:2130)
	at
javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelectionImpl(BasicTreeUI.java:3495)
	at
javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(BasicTreeUI.java:3480)
	at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(BasicTreeUI.java:3461)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
	at java.awt.Component.processMouseEvent(Component.java:5485)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
	at java.awt.Component.processEvent(Component.java:5253)
	at java.awt.Container.processEvent(Container.java:1966)
	at java.awt.Component.dispatchEventImpl(Component.java:3955)
	at java.awt.Container.dispatchEventImpl(Container.java:2024)
	at java.awt.Component.dispatchEvent(Component.java:3803)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3889)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
	at java.awt.Container.dispatchEventImpl(Container.java:2010)
	at java.awt.Window.dispatchEventImpl(Window.java:1774)
	at java.awt.Component.dispatchEvent(Component.java:3803)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 1 Petr Nejedly 2006-12-14 16:44:07 UTC
There is a race condition, obviously. Running on a dualcore or SMP by a chance?
The cast in getParentChildren is guarded by an instanceof, but if another thread
replaces the instance between the check and the cast...
Definitely a NetBeans issue. Not enough synchronization in there.
Comment 2 santhosh 2006-12-14 17:16:09 UTC
I am not sure.

This is reported by our QA Team on windows XP;
When I tried on my Intel Core Duo MacBook, i am unable to reproduce;
I tried on windows XP also, but couldn't reproduce;
seems difficult/rarely reproduced;

Yes. this is clearly Threading issue.

for the timebeing, I am caching ClassCastException and returning null in my
code, so that it doesn't produce such errors to user;
Comment 3 Jaroslav Tulach 2007-10-18 12:56:55 UTC
DE:-------------------------------------------------
IDE: [18.10.07 13:56] Committing "Node.java" started
Checking in Node.java;
/shared/data/ccvs/repository/openide/nodes/src/org/openide/nodes/Node.java,v  <--  Node.java
new revision: 1.16; previous revision: 1.15
done
IDE: [18.10.07 13:56] Committing "Node.java" finished