Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357783 - strange while-loop in xtext popup editors (org.eclipse.papyrus.xxxx.editor.xtext.ui)
Summary: strange while-loop in xtext popup editors (org.eclipse.papyrus.xxxx.editor.xt...
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 1.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: M7   Edit
Assignee: Camille Letavernier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-15 08:07 EDT by m kranz CLA
Modified: 2014-03-13 07:57 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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