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 Daniel and Christian,

as I ran into that problem at least twice, I'd like to encourage you to provide that help to the users.

One thing I'd like to point out is that the wizard does some "magic" (not checking dangling edges, convert to the runtime model instead) that is not automagically done when you are using the API. This magic could be pointed out by the wizard, e.g. with hint-messages:
"The instance model uses the development version of the meta model X. The wizard uses the runtime version instead."
or
"The rules define checkDanglingEdges = true. The wizards uses checkDanglingEdges=false instead."

This might help the users.

Cheers and thank you for your help
Marco



Am 12.09.2012 10:32, schrieb Daniel Strüber:
I have an idea: Since the migration from development to runtime version and even back should be a not so uncommon activity - which yet has to be done by hand as you described -, it could be supported by a migration feature that performs this String replacement automatically. This feature could be added to the context menu for .henshin files ("Convert imports to runtime/development mode..."), calling attention to the existence of different import modes.

Regards,
Daniel


Am 12.09.2012 10:12, schrieb Daniel Strüber:
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 


_______________________________________________
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 


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


Back to the top