Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Null pointer exception using profiles(Null pointer using profiles)
[Acceleo] Null pointer exception using profiles [message #673770] Tue, 24 May 2011 17:25 Go to next message
Alessandro Tiso is currently offline Alessandro TisoFriend
Messages: 17
Registered: February 2011
Junior Member
hi all,

I have a simple transformation on a model written using papyrus. The model has only two classes, one of which has applied a stereotype with two tagged values. The profile was written using papyrus.
When I run the transformation a Null pointer exception is raised.
The simple transformation is :

[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/uml2/3.0.0/UML')/]
[query public hasStereotype(e : Element, stereoTypeName: String) : Boolean  = 
	not self.getAppliedStereotype(stereoTypeName).oclIsUndefined()/]
 
[query public getTaggedValue(e:Element, stereoTypeName: String, propName :String) : String = 
	e.getValue(e.getAppliedStereotype(stereoTypeName), propName)  
 /]
[template public generate(aClass : Class)]
	
	[comment @main /]
	[file ('test.txt', true, 'UTF-8')]
[if (aClass.hasStereotype('profile::Store'))]
	Class with stereotype: [aClass.name/]
[/if]

	[/file]
	
[/template]



The stack trace is :
java.lang.NullPointerException
at org.eclipse.acceleo.engine.internal.environment.DynamicModulesURIConverter.dynamicNormalize(DynamicModulesURIConverter.java:303)
at org.eclipse.acceleo.engine.internal.environment.DynamicModulesURIConverter.normalize(DynamicModulesURIConverter.java:77)
at org.eclipse.uml2.common.util.CacheAdapter$InverseCrossReferencer.normalizeURI(CacheAdapter.java:68)
at org.eclipse.uml2.common.util.CacheAdapter$InverseCrossReferencer.addProxy(CacheAdapter.java:101)
at org.eclipse.uml2.common.util.CacheAdapter.selfAdapt(CacheAdapter.java:526)
at org.eclipse.emf.ecore.util.ECrossReferenceAdapter.notifyChanged(ECrossReferenceAdapter.java:430)
at org.eclipse.uml2.common.util.CacheAdapter.notifyChanged(CacheAdapter.java:342)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.unload(ResourceImpl.java:1646)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.postGenerate(AbstractAcceleoGenerator.java:453)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:145)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.doGenerate(AbstractAcceleoGenerator.java:120)
at profileTestAcceleo2.files.Generate.doGenerate(Generate.java:148)
at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoLaunchOperation.run(AcceleoLaunchOperation.java:119)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginLaunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java:225)
at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginLaunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java:128)
at org.eclipse.acceleo.internal.ide.ui.launching.AcceleoLaunchDelegate.launch(AcceleoLaunchDelegate.java:53)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:923)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1126)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)




What is wrong?

Thank in advance.


P.S. The output file is generated as expected.

Re: [Acceleo] Null pointer exception using profiles [message #673821 is a reply to message #673770] Tue, 24 May 2011 20:41 Go to previous messageGo to next message
Alessandro Tiso is currently offline Alessandro TisoFriend
Messages: 17
Registered: February 2011
Junior Member
Hi all,

I've found that when I do not use query I do not see any exception. This is very strange for me.
Can some one explain why?

Any help is appreciated
(no subject) [message #673825 is a reply to message #673770] Tue, 24 May 2011 20:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: <forums-noreply

Hi all,

I've found that when I do not use query I do not see any exception. This is very strange for me.
Can some one explain why?

Any help is appreciated
Re: (no subject) [message #675136 is a reply to message #673821] Mon, 30 May 2011 11:58 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

When we are unloading the resources, the UML cross referencer is notified and it calls the normalize method but this method has been created for EObject contained in a resource. I have modified "normalize" to make sure that the NPE does not appear anymore for EObjects without a resource. Thanks for reporting this. I don't know why this would only be called with a query.

Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
Re: (no subject) [message #675556 is a reply to message #675136] Tue, 31 May 2011 20:35 Go to previous messageGo to next message
Alessandro Tiso is currently offline Alessandro TisoFriend
Messages: 17
Registered: February 2011
Junior Member
Thank you for the response.

What version of eclipse Acceleo has this patch?
How can I use it?


Re: (no subject) [message #675689 is a reply to message #675556] Wed, 01 June 2011 08:12 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

You can grab the latest Release Candidate of Acceleo with this update site: http://download.eclipse.org/modeling/m2t/acceleo/updates/milestones/3.1
You should find this problem fixed in Acceleo 3.1 RC3

Don't hesitate to tell us if this has not fixed your issue.

Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
Previous Topic:[Acceleo] Workspace ecore models URI resolution
Next Topic:org.eclipse.emf.mwe.core.ConfigurationException: Couldn't find an interface ...
Goto Forum:
  


Current Time: Fri Apr 26 05:25:02 GMT 2024

Powered by FUDForum. Page generated in 0.05607 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top