Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] NPE when using Attribute in UML instance models

Hi Christian,

thank you very much for your support. The workaround did not work. 

I noticed that the wizard has no problems with the execution. I will also have a look at the code. 

Cheers
Marco

Am 11.09.2012 um 19:12 schrieb "Christian Krause" <henshin.ck@xxxxxxxxx>:

Hi Marco,

this exception is probably caused by a missing proxy resolution. A similar problem has been reported before. I am now inclined to enforce the resolution of all proxy objects during loading. I will make some experiments and see whether it works.

If you don't want to wait for the next release which will fix the problem (I expect that we roll out a new version in the next 2 weeks), you could try the following (works only if you execute it in code): before applying the transformation, run EcoreUtil.resolveAll(system), where system is your transformation system. I don't know if that works. I will try it out in the next days.

Cheers,
christian

On 9/11/2012 5:31 PM, Marco Konersmann wrote:
Hello again,

working on UML models, I ran into another error that I hope you can help me with.
My UML instance model is:
Model --packagedElement--> Component (name:WebShop)

My transformation rule is:
<<preserve>> Model --<<delete>>PackagedElement---> <<delete>> Component (name="WebShop")

This gives me a NPE:
Exception in thread "main" java.lang.NullPointerException
    at org.eclipse.emf.henshin.interpreter.info.VariableInfo.createConstraints(VariableInfo.java:168)
    at org.eclipse.emf.henshin.interpreter.info.VariableInfo.createVariables(VariableInfo.java:104)
    at org.eclipse.emf.henshin.interpreter.info.VariableInfo.<init>(VariableInfo.java:70)
    at org.eclipse.emf.henshin.interpreter.info.RuleInfo.<init>(RuleInfo.java:29)
    at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.getRuleInfo(EngineImpl.java:499)
    at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchFinder.<init>(EngineImpl.java:197)
    at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchGenerator.iterator(EngineImpl.java:157)
    at org.eclipse.emf.henshin.interpreter.impl.RuleApplicationImpl.execute(RuleApplicationImpl.java:90)
    at init.Example.run(Example.java:61)
    at init.Example.main(Example.java:75)

in createConstraints(..) line 168 is:
attributeValue = castDown(attributeValue, attribute.getType().getEType().getInstanceClassName());
with attribute.getType().getEType() being null.

attribute.getType() resolves to
"org.eclipse.emf.ecore.impl.EAttributeImpl@4a646ffe (eProxyURI: ../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//NamedElement/name)"
That "name" attribute has the EType "String [java.lang.String]" in the meta model.

Is this a bug in Henshin, or do I use the API in a wrong way?

I attached an example project.

Best regards
Marco




_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev

_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev

Back to the top