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

Bug 357783

Summary: strange while-loop in xtext popup editors (org.eclipse.papyrus.xxxx.editor.xtext.ui)
Product: [Modeling] Papyrus Reporter: m kranz <Marco.Kranz>
Component: CoreAssignee: Camille Letavernier <cletavernier>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: arnaud.cuccuru
Version: 1.0.0   
Target Milestone: M7   
Hardware: All   
OS: All   
Whiteboard:

Description m kranz CLA 2011-09-15 08:07:50 EDT
Build Identifier: 20110615-0604

the code in question is located in org.eclipse.papyrus.message.editor.xtext.ui.contributions.MessagePopupEditor.java,
line 193 ff.
it seems to be the same for all xxxPopupEditors as far as i checked.
code snippet:

public void reconcile(EObject modelObject, EObject xtextObject) {
				// first: retrieves / determines if the xtextObject is a MessageRule object
				EObject modifiedObject = xtextObject;
				if(!(modelObject instanceof Message))
					return;
				while(xtextObject != null && !(xtextObject instanceof MessageRule)) {
					modifiedObject = modifiedObject.eContainer();
				}
				if(modifiedObject == null)
					return;
				MessageRule messageRuleObject = (MessageRule)xtextObject;

not sure what this code was supposed to do, but as far as i see the while-loop is infinite. it does not seem to ever be entered however(as far as i noticed).

cheers

marco

Reproducible: Always
Comment 1 Arnaud Cuccuru CLA 2013-03-13 13:35:48 EDT
Not able to reproduce the bug in Kepler M5, since Xtext embedded editors are not connected yet.
Comment 2 m kranz CLA 2013-03-14 08:28:05 EDT
hello arnaud

you do not have to run the code, just look at the while loop.
the object (xtextObject) that is used in the while-condition
is never actually altered within the loop, so the loop's infinite.

cheers

mkranz
Comment 3 m kranz CLA 2013-03-14 08:33:24 EDT
ok, looking at the code again it will most likely end up in a nullpointer exception since modifiedObject might be null sooner or later and then
modifiedObject.eContainer() will break things.
Comment 4 Camille Letavernier CLA 2014-03-13 07:57:50 EDT
Fixed in 9356316, pushed to master