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

Dear Christian,

this hint and the migration to the runtime version of the meta model solved my problem.
I am sorry I forgot to check the version again.

Best regards
Marco

Am 12.09.2012 09:51, schrieb Christian Krause:
Hi Marco,

the UML metamodel contains a lot of derived / renamed references (e.g "ownedElement", "packagedElements" etc.). Henshin currently treats them as separate edges and refuses to delete the node because these edges are not explicitly removed by the rule. To make it work, set the attribute "checkDangling" in the rule to false. Then it works.

cheers
christian

On 09/11/2012 07:54 PM, Konersmann, Marco wrote:
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


_______________________________________________
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