Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338167

Summary: NPE when rebuilding graph
Product: [Tools] GEF Reporter: Miles Parker <milesparker>
Component: GEF-Legacy ZestAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: nyssen, steeg, zoltan.ujhelyi
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Miles Parker CLA 2011-02-24 18:56:06 EST
I'm getting the following exception. I'm not 100% sure that there isn't an issue with the backing model, but as I am using IGraphContentProvider I'm not really sure what if anything could end up creating a situation where the following occurs:


Daemon Thread [Thread-0] (Suspended (exception NullPointerException))	
	TreeLayoutObserver$TreeNode.isBetterParent(TreeLayoutObserver$TreeNode) line: 262	
	TreeLayoutObserver$TreeNode.findNewParent() line: 236	
	TreeLayoutObserver$1.connectionRemoved(LayoutContext, ConnectionLayout) line: 365	
	InternalLayoutContext.fireConnectionRemovedEvent(ConnectionLayout) line: 444	
	Graph.removeConnection(GraphConnection) line: 936	
	GraphConnection.setCurveDepth(int) line: 476	
	GraphModelFactory(AbstractStylingModelFactory).adjustCurves(List, int) line: 99	
	GraphModelFactory(AbstractStylingModelFactory).styleConnection(GraphConnection) line: 75	
	GraphModelFactory(AbstractStylingModelFactory).styleItem(GraphItem) line: 123	
	GraphModelFactory(AbstractStylingModelFactory).createConnection(Graph, Object, Object, Object) line: 182	
	GraphModelFactory.doBuildGraph(Graph) line: 105	
	GraphModelFactory.createGraphModel(Graph) line: 43	
	ButterGraphViewer(AbstractStructuredGraphViewer).inputChanged(Object, Object) line: 516	
	ButterGraphViewer(GraphViewer).inputChanged(Object, Object) line: 127	
	ButterGraphViewer(ContentViewer).setInput(Object) line: 280	
	ButterGraphViewer(StructuredViewer).setInput(Object) line: 1669	
	ButterGraphViewPart$1$2.selectionChanged(IWorkbenchPart, ISelection) line: 123	
	WindowSelectionService(AbstractSelectionService).fireSelection(IWorkbenchPart, ISelection) line: 156	
	AbstractSelectionService$1.selectionChanged(SelectionChangedEvent) line: 62	

...
Comment 1 Miles Parker CLA 2011-02-24 18:57:14 EST
[This is with 2.0 -- as there aren't version #s for Zest.]
Comment 2 Fabian Steeg CLA 2011-02-26 17:17:23 EST
One hint from that stack trace is that it occurs with either multiple connections between nodes or nodes connected to themselves (since a recent change such connections are curved, see bug 190223). I've added some null checks in TreeLayoutObserver that I think make sense in any case. I don't really know how these items could be null in such a case though, so if this doesn't fix your issue, it would be great if you could attach a snippet that causes this exception.
Comment 3 Miles Parker CLA 2011-02-26 20:04:46 EST
(In reply to comment #2)
> One hint from that stack trace is that it occurs with either multiple
> connections between nodes or nodes connected to themselves (since a recent
> change such connections are curved, see bug 190223). I've added some null
> checks in TreeLayoutObserver that I think make sense in any case. I don't
> really know how these items could be null in such a case though, so if this
> doesn't fix your issue, it would be great if you could attach a snippet that
> causes this exception.

That makes sense, it was coming up when I had two directed nodes connected to each other. Now that my model doesn't I don't see this error anymore. I'll keep an eye on it in any case. I'm using the version from git so I'll have any changes as they are made.
Comment 4 Fabian Steeg CLA 2011-02-26 21:05:39 EST
With the new null checks it might now work for your previous model as well. For me it worked with multiple connections even before, e.g. in [1]. If you confirm it works for you with multiple connections I'll resolve as fixed.

[1] http://git.eclipse.org/c/gef/org.eclipse.zest.git/tree/org.eclipse.zest.examples/src/org/eclipse/zest/examples/jface/GraphJFaceSnippet8.java
Comment 5 Alexander Nyßen CLA 2014-08-24 11:15:10 EDT
Resolving as FIXED because of Fabian's last comment (and because there has been no reaction to this for more than 3 years). Please re-open in case this is still an issue.
Comment 6 Alexander Nyßen CLA 2014-08-24 11:15:34 EDT
Ups, forgot to actually change state...