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

Bug 520561

Summary: DOT Outline View throws an Exception when parsing an incomplete dot file.
Product: [Tools] GEF Reporter: Tamas Miklossy <miklossy>
Component: GEF DOTAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 5.0.1 (Oxygen.1) RC1   
Hardware: PC   
OS: Windows NT   
Whiteboard:

Description Tamas Miklossy CLA 2017-08-04 07:28:50 EDT
The following Exception is thrown by the DOT Outline View when trying to parse incomplete dot file (e.g: graph{ 1-- }.

org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=0, size=0
	at org.eclipse.emf.common.util.BasicEList.get(BasicEList.java:346)
	at org.eclipse.gef.dot.internal.ui.language.labeling.DotLabelProvider.text(DotLabelProvider.java:107)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.xtext.ui.label.DeclarativeLabelProvider.doGetText(DeclarativeLabelProvider.java:49)
	at org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider.doGetText(DefaultEObjectLabelProvider.java:35)
	at org.eclipse.xtext.ui.label.AbstractLabelProvider.getStyledText(AbstractLabelProvider.java:119)
	at org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider._text(DefaultOutlineTreeProvider.java:247)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider._createNode(DefaultOutlineTreeProvider.java:153)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider.createNode(DefaultOutlineTreeProvider.java:137)
	at org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider._createChildren(DefaultOutlineTreeProvider.java:118)


The DotLabelProvider should be prepared to be able to provide a text even for incomplete dot statements to avoid throwing a NullPointerException.
Comment 1 Tamas Miklossy CLA 2017-08-04 07:38:18 EDT
The following changes are published on the origin/R5_0_0_maintenance and origin/master branches:

[520561] Avoid NPE in Dot Outline View in case of incomplete statements.

- Modify the DotLabelProvider to be able to provide a text for an
incomplete EdgeStmtNode without throwing a NullPointerException.
- Implement corresponding DotOutlineViewTests test cases.