Bug 509315 - NPE when syncing user code from source code to textual model
Summary: NPE when syncing user code from source code to textual model
Status: ASSIGNED
Alias: None
Product: Papyrus-rt
Classification: Modeling
Component: textual (show other bugs)
Version: 0.7.2   Edit
Hardware: PC Windows NT
: P3 normal
Target Milestone: Future   Edit
Assignee: Ernesto Posse CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-15 15:58 EST by Young-Soo Roh CLA
Modified: 2017-06-12 10:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Young-Soo Roh CLA 2016-12-15 15:58:45 EST
Generate code from textual model then the following NPE thrown when trying to sync user code from generate source.


java.lang.NullPointerException
	at org.eclipse.papyrusrt.xtumlrt.xtext.codegen.ui.cdt.UmlrtXtextEObjectLocator.getTransition(UmlrtXtextEObjectLocator.java:301)
	at org.eclipse.papyrusrt.xtumlrt.xtext.codegen.ui.cdt.UmlrtXtextEObjectLocator.getUserCodeElement(UmlrtXtextEObjectLocator.java:189)
	at org.eclipse.papyrusrt.xtumlrt.xtext.codegen.ui.cdt.UmlrtXtextEObjectLocator.getEObject(UmlrtXtextEObjectLocator.java:127)
	at org.eclipse.papyrusrt.xtumlrt.xtext.codegen.ui.cdt.UmlrtXtextEObjectLocator.saveSource(UmlrtXtextEObjectLocator.java:372)
	at org.eclipse.papyrusrt.codegen.EObjectLocator.saveSource(EObjectLocator.java:96)
	at org.eclipse.papyrusrt.codegen.UserEditableRegion.commit(UserEditableRegion.java:235)
	at org.eclipse.papyrusrt.codegen.build.GeneratedSrcBuilder.commit(GeneratedSrcBuilder.java:466)
Comment 1 Ernesto Posse CLA 2017-06-08 18:13:28 EDT
(In reply to Young-Soo Roh from comment #0)
> Generate code from textual model then the following NPE thrown when trying
> to sync user code from generate source.
> 
> 
> java.lang.NullPointerException
> 	at
> org.eclipse.papyrusrt.xtumlrt.xtext.codegen.ui.cdt.UmlrtXtextEObjectLocator.
> getTransition(UmlrtXtextEObjectLocator.java:301)

Can you give a bit more info on this? Does it happen with any model? 

The NPE occurs in the CDT integration, and I've never touched that code, so I'm not sure why the CDT integration fails.  

Furthermore, it may be an old error, because the line (301) where the NPE happens is a closing brace '}'.

Maybe the error is with the preceding code?

for (Trigger t : transition.getTriggers()) {
	RTTrigger trigger = (RTTrigger) t;
	if (trigger.getSignal().getName().equals(detail.getSignal()) && comparetriggerPorts(trigger.getPorts(), detail.getPorts())) {
		found = true;
		break;
	}

If that's the case, it looks like maybe the CDT integration is making some (incorrect) assumptions about what it expects to see in the (xtUMLrt) model.

In any case, I'm not sure this is critical for 1.0.
Comment 2 Young-Soo Roh CLA 2017-06-12 09:20:44 EDT
I think this is textual only issue and Simon said that we should move it out of 1.0 in this case.

(In reply to Ernesto Posse from comment #1)
> (In reply to Young-Soo Roh from comment #0)
> > Generate code from textual model then the following NPE thrown when trying
> > to sync user code from generate source.
> > 
> > 
> > java.lang.NullPointerException
> > 	at
> > org.eclipse.papyrusrt.xtumlrt.xtext.codegen.ui.cdt.UmlrtXtextEObjectLocator.
> > getTransition(UmlrtXtextEObjectLocator.java:301)
> 
> Can you give a bit more info on this? Does it happen with any model? 
> 
> The NPE occurs in the CDT integration, and I've never touched that code, so
> I'm not sure why the CDT integration fails.  
> 
> Furthermore, it may be an old error, because the line (301) where the NPE
> happens is a closing brace '}'.
> 
> Maybe the error is with the preceding code?
> 
> for (Trigger t : transition.getTriggers()) {
> 	RTTrigger trigger = (RTTrigger) t;
> 	if (trigger.getSignal().getName().equals(detail.getSignal()) &&
> comparetriggerPorts(trigger.getPorts(), detail.getPorts())) {
> 		found = true;
> 		break;
> 	}
> 
> If that's the case, it looks like maybe the CDT integration is making some
> (incorrect) assumptions about what it expects to see in the (xtUMLrt) model.
> 
> In any case, I'm not sure this is critical for 1.0.
Comment 3 Charles Rivet CLA 2017-06-12 10:05:30 EDT
Textual only - moving to future