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

Hey Christian,

this seems to be a frequent obstacle: one of our students just stumbled upon the same problem - related to  "meta-model schizophrenia" as it is called in the EMF mailing list - while using Henshin.

A FAQ entry or even a hint somewhere in the tooling could be supportive to users, although I am not sure what the best place to put such a hint would be (having closed the import dialog inattentively, you never see it again).

Regards,
Daniel


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

your transformation does not import the runtime version of the UML metamodel (I think I mentioned this before). When you import the UML metamodel, you must click on "runtime version", and not "development version". You can "migrate" your transformation like this: open the *.henshin file in a text editor and replace every occurrence of:

../../plugin/org.eclipse.uml2.uml/model/UML.ecore

by

http://www.eclipse.org/uml2/3.0.0/UML

and run it again. The rule can still not be applied but the error message does not appear. I hope that there is not another problem...

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


-- 
Dipl.-Inf. Daniel Strüber
Philipps-Universität Marburg
Fachbereich Mathematik und Informatik
Mehrzweckgebäude 05D12
Hans-Meerwein-Str.
D-35032 Marburg
Tel: +49-6421-28-21511
Email: strueber@xxxxxxxxxxxxxxxxxxxxxxxxx 

Back to the top