Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » [EMFTVM] null pointer exception when executing transformation
[EMFTVM] null pointer exception when executing transformation [message #1196696] Tue, 19 November 2013 09:50 Go to next message
EtienneB Mising name is currently offline EtienneB Mising name
Messages: 35
Registered: June 2011
Member
Dear all,

I am using EMFTV to implement and run HOTs (take ATL as input and produces ATL code). Everything was working fine when runing the result of the hot on two different test cases.

With a third one, I get an exception and the only information I get is the following exception trace:

java.lang.NullPointerException
	at org.eclipse.m2m.atl.emftvm.impl.RuleImpl.createUniqueMapping(RuleImpl.java:2273)
	at org.eclipse.m2m.atl.emftvm.impl.RuleImpl.createAllUniqueMappings(RuleImpl.java:3527)
	at org.eclipse.m2m.atl.emftvm.impl.RuleImpl.access$8(RuleImpl.java:3525)
	at org.eclipse.m2m.atl.emftvm.impl.RuleImpl$IsNotAbstractState.createTraces(RuleImpl.java:957)
	at org.eclipse.m2m.atl.emftvm.impl.RuleImpl.createTraces(RuleImpl.java:2146)
	at org.eclipse.m2m.atl.emftvm.impl.ExecEnvImpl.matchAllSingle(ExecEnvImpl.java:2230)
	at org.eclipse.m2m.atl.emftvm.impl.ExecEnvImpl.run(ExecEnvImpl.java:2083)


the code executed is

public void createUniqueMapping(TraceLink trace) {
	uniqueState.createUniqueMapping(trace);
}


so the proble here is that field uniqueState is null. I am not so familiar with the code of the emftvm runtime, so could someone give me a hint on what is happening here?

Thanks!
Etienne.

[Updated on: Tue, 19 November 2013 09:59]

Report message to a moderator

Re: [EMFTVM] null pointer exception when executing transformation [message #1197142 is a reply to message #1196696] Tue, 19 November 2013 14:36 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis Wagelaar
Messages: 155
Registered: September 2012
Senior Member

uniqueState is part of the state pattern found in RuleImpl, and is part of the adaptive rule matching algorithm. When executing a transformation for the first time, all state fields of each rule are set ("compiled") in ExecEnvImpl.java:2070. By "each rule", I mean all rules that are registered to the ExecEnvImpl instance via loadModule().

The particular code you mention above accesses the uniqueState of a superrule of the (unique lazy) rule being executed. The only way for the uniqueState of that superrule to be null is if somehow compileState() wasn't called on that rule in ExecEnvImpl.java:2070.


Cheers,
Dennis
Re: [EMFTVM] null pointer exception when executing transformation [message #1197269 is a reply to message #1197142] Tue, 19 November 2013 15:53 Go to previous messageGo to next message
EtienneB Mising name is currently offline EtienneB Mising name
Messages: 35
Registered: June 2011
Member
Ok, thanks for your answer. I will continue to investigate with the information you gave me; I will let you know if I find something.

Best regards,
Etienne.
Re: [EMFTVM] null pointer exception when executing transformation [message #1197453 is a reply to message #1197269] Tue, 19 November 2013 17:56 Go to previous messageGo to next message
EtienneB Mising name is currently offline EtienneB Mising name
Messages: 35
Registered: June 2011
Member
Dear Dennis,

after looking at the execution of my case study, I think I spotted the source of the problem:

In a module M1, I have a rule R, and a rule R1 that extends R
In a module M2, I super-impose R and I have a rule R2 that extends R.

I first load M1, then M2, and then I execute run. When loading M1, EMFTVM registers R and R1; R is set as a super rule of R1. When loading M1, EMFTVM registers R2 and replace R(M1) by R(M2) in the map called rules (in ExecEnvImpl).

Then at the beginning of run (line 2070) only the R(M2) sees its uniqueState field updated (indeed, R(M1) in no longer in the map, so getRules() does not return it).

Then when executing createTraces on R1, it retreives the super-rule R(M1) instead of R(M2). Since R(M1) has a null uniqueState, I get the exception referenced in my first message.

I am not sure my initial case-study is a legal one, but my multi-objectives ATL implementation led me to such a situation. If it is not legal, it should be checked and clarifier. If it is legal, I guess a fix could be to retreive super-rules by looking in the rules map (the on stored in ExecEnvImpl) when creating traces.

Looking forward for your clarifications, hope my message helps!
Best regards,
Etienne.
Re: [EMFTVM] null pointer exception when executing transformation [message #1211798 is a reply to message #1197453] Tue, 26 November 2013 11:30 Go to previous message
Dennis Wagelaar is currently offline Dennis Wagelaar
Messages: 155
Registered: September 2012
Senior Member

This should not be possible, because ExecEnvImpl#loadModule() already deals with this on line 1249:

// Re-resolve all super-rules, because they may have been redefined
for (Rule r : getRules()) {
	resolveSuperRules(r);
}


Can you verify in a debugger what is going on? Otherwise: can you report a bug with test transformation attached and test procedure? Thanks!

Dennis


Cheers,
Dennis
Previous Topic:ATL and JAVA code calling (alternative QVT...)
Next Topic:Problem when using GetValue
Goto Forum:
  


Current Time: Sat Aug 23 09:24:24 EDT 2014

Powered by FUDForum. Page generated in 0.01730 seconds