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

Bug 351504

Summary: Null pointer exception in xtext editor
Product: [Modeling] TMF Reporter: Peter Feiler <phf>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow
Version: unspecifiedFlags: sebastian.zarnekow: indigo+
Target Milestone: SR1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Peter Feiler CLA 2011-07-07 21:16:55 EDT
Build Identifier: Xtext 2.0.0.v201106070531

When entering a new rule between existing rules after typing the rule name and then the keyword returns and then pausing for a moment the NPE is thrown when refreshing the outline. This occurs when the grammar imports an existing ecore model, but not when the ecore model is generated.

The grammar:

grammar org.osate.xtext.aadl2.errormodel.ErrorModel with org.eclipse.xtext.common.Terminals

import "platform:/resource/org.osate.aadl2/model/aadl2.ecore" as aadl2

PModel returns aadl2::Element:
	PropertySet ;
xx returns !!! causes the error
PropertySet returns aadl2::PropertySet:
	'property' 'set' name=ID 'is'
	'end' ID ';' ;


java.lang.NullPointerException
	at org.eclipse.xtext.xtext.ui.editor.outline.XtextOutlineTreeProvider.getReturnTypeText(XtextOutlineTreeProvider.java:63)
	at org.eclipse.xtext.xtext.ui.editor.outline.XtextOutlineTreeProvider._createNode(XtextOutlineTreeProvider.java:95)
	at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider.createNode(DefaultOutlineTreeProvider.java:104)
	at org.eclipse.xtext.xtext.ui.editor.outline.XtextOutlineTreeProvider._createChildren(XtextOutlineTreeProvider.java:103)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider.createChildren(DefaultOutlineTreeProvider.java:77)
	at org.eclipse.xtext.ui.editor.outline.impl.AbstractOutlineNode$1.process(AbstractOutlineNode.java:80)
	at org.eclipse.xtext.ui.editor.outline.impl.AbstractOutlineNode$1.process(AbstractOutlineNode.java:1)
	at org.eclipse.xtext.util.concurrent.IUnitOfWork$Void.exec(IUnitOfWork.java:36)
	at org.eclipse.xtext.ui.editor.outline.impl.AbstractOutlineNode$2.exec(AbstractOutlineNode.java:161)
	at org.eclipse.xtext.ui.editor.outline.impl.AbstractOutlineNode$2.exec(AbstractOutlineNode.java:1)
	at org.eclipse.xtext.util.concurrent.AbstractReadWriteAcces.readOnly(AbstractReadWriteAcces.java:32)
	at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:86)
	at org.eclipse.xtext.ui.editor.outline.impl.AbstractOutlineNode.readOnly(AbstractOutlineNode.java:158)
	at org.eclipse.xtext.ui.editor.outline.impl.AbstractOutlineNode.getChildren(AbstractOutlineNode.java:77)
	at org.eclipse.xtext.ui.editor.outline.impl.OutlineRefreshJob.restoreChildrenSelectionAndExpansion(OutlineRefreshJob.java:68)
	at org.eclipse.xtext.ui.editor.outline.impl.OutlineRefreshJob.restoreChildrenSelectionAndExpansion(OutlineRefreshJob.java:71)
	at org.eclipse.xtext.ui.editor.outline.impl.OutlineRefreshJob$1.exec(OutlineRefreshJob.java:60)
	at org.eclipse.xtext.ui.editor.outline.impl.OutlineRefreshJob$1.exec(OutlineRefreshJob.java:1)
	at org.eclipse.xtext.util.concurrent.AbstractReadWriteAcces.readOnly(AbstractReadWriteAcces.java:32)
	at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:86)
	at org.eclipse.xtext.ui.editor.outline.impl.OutlineRefreshJob.refreshOutlineModel(OutlineRefreshJob.java:57)
	at org.eclipse.xtext.ui.editor.outline.impl.OutlineRefreshJob.run(OutlineRefreshJob.java:46)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


Reproducible: Always

Steps to Reproduce:
1. Take a grammar referencing an existing ecore model
2. Have at least two rules
3. Enter a third rule between the two and pasue after the keyword returns
Comment 1 Sebastian Zarnekow CLA 2011-07-22 11:03:13 EDT
Hi Peter,

the sample grammar does not provide a NPE, neither with "show return types" or "hide return types" in the outline view. Marked as works for me.
Comment 2 Karsten Thoms CLA 2017-09-19 17:05:47 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 17:17:40 EDT
Closing all bugs that were set to RESOLVED before Neon.0