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

Bug 206298

Summary: NPE in AbstractStructuredGraphViewer.findItems()
Product: [Tools] GEF Reporter: Philippe Coucaud <phil_fj12>
Component: GEF-Legacy ZestAssignee: Ian Bull <irbull>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Philippe Coucaud CLA 2007-10-15 05:48:33 EDT
Build ID:  I20070625-1500

org.eclipse.mylyn.zest.core and org.eclipse.mylyn.zest.layouts plug-ins from CVS.

Steps To Reproduce:
1. call GraphViewer.setSelection() with an argument that is not of type IStructuredSelection.
2. StructuredViewer.setSelectionToWidget(ISelection, boolean) then calls GraphViewer.setSelectionToWidget(List, boolean) with null as first argument
3. AbstractStructuredGraphViewer.findItems(List) dereferences the list argument without checking for null -> NPE.


More information:
Thread [main] (Suspended (exception NullPointerException))	
	GraphViewer(AbstractStructuredGraphViewer).findItems(List) line: 366	
	GraphViewer.setSelectionToWidget(List, boolean) line: 208	
	GraphViewer(StructuredViewer).setSelectionToWidget(ISelection, boolean) line: 1685	
	GraphViewer(StructuredViewer).setSelection(ISelection, boolean) line: 1639	
	GraphViewer(Viewer).setSelection(ISelection) line: 392	
[...]
Comment 1 Ian Bull CLA 2008-10-10 18:22:09 EDT
I have added a check for null in the find items method.  

Thanks for the bug and the tips!