Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Exception when invoking a helper method
Exception when invoking a helper method [message #915025] Sun, 16 September 2012 07:35 Go to next message
Rami D. is currently offline Rami D.Friend
Messages: 14
Registered: August 2012
Junior Member
Hi,

I've added a new helper method to the existing file xpt/diagram/editparts/Utils.qvto:

helper getLabelText(classbody : String, key : String) : String {

var s : String := classbody;
...

return newStr;
}


Then i call this method from a template file
«DEFINE figureText(key : String) FOR gmfgen::InnerClassViewmap»
	«getLabelText(self.classBody,key)»
«ENDDEFINE»


While generating the diagram code I get the following exception:

Problems while generating code
Exception (Cannot find operation (getLabelText(String, String)) for the type (null):in aspects::impl::diagram::editparts::NodeEditPart, line 34) while generating code


I can rule out that neither 'self.classbody' nor 'key' is null, because when I use the arguments in the template itself, everything works fine. What could be the reason for that problem?

Regards,
Rami
Re: Exception when invoking a helper method [message #915036 is a reply to message #915025] Sun, 16 September 2012 08:27 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

It is very likely that an error message complaining about 'null' is
because at the point the error is generated the problem context is
indeed null.

You rule out 'self.classbody' nor 'key' being null but

- are they the correct contexts to rule out
- is your observation an observation of the actual state at the actual time

In the absence of anyone recognising the problem, you need to debug why
the Exception arises.

You may have more luck on the GMF newsgroup since this is unlikely to be
a QVTo problem.

Regards

Ed Willink


On 16/09/2012 08:35, Rami D. wrote:
> Hi,
>
> I've added a new helper method to the existing file
> xpt/diagram/editparts/Utils.qvto:
>
>
> helper getLabelText(classbody : String, key : String) : String {
>
> var s : String := classbody;
> ...
>
> return newStr;
> }
>
>
> Then i call this method from a template file
> «DEFINE figureText(key : String) FOR gmfgen::InnerClassViewmap»
> «getLabelText(self.classBody,key)»
> «ENDDEFINE»
>
>
> While generating the diagram code I get the following exception:
>
>
> Problems while generating code
> Exception (Cannot find operation (getLabelText(String, String)) for
> the type (null):in aspects::impl::diagram::editparts::NodeEditPart,
> line 34) while generating code
>
>
> I can rule out that neither 'self.classbody' nor 'key' is null,
> because when I use the arguments in the template itself, everything
> works fine. What could be the reason for that problem?
>
> Regards,
> Rami
Re: Exception when invoking a helper method [message #915089 is a reply to message #915036] Sun, 16 September 2012 12:13 Go to previous messageGo to next message
Rami D. is currently offline Rami D.Friend
Messages: 14
Registered: August 2012
Junior Member
Hi Ed,

thanks for your reply.
How can I debug qvto files and templates respectively?
And what exacetly do you mean by "observation of the actual state at the actual time
". I observe this exception when regenerating the diagram code (right click on the .gmfgen file->Generate diagram code)

Regards,
Rami
Re: Exception when invoking a helper method [message #915119 is a reply to message #915089] Sun, 16 September 2012 14:09 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

On 16/09/2012 13:13, Rami D. wrote:
> Hi Ed,
>
> thanks for your reply. How can I debug qvto files and templates
> respectively?
If you start Eclipse with

-Xrunjdwp:server=y,transport=dt_socket,address=14143,suspend=n

you can attach another Eclipse session to debug it.

Else you saturate with 'printf's or you use a nested Eclipse.
> And what exacetly do you mean by "observation of the actual state at
> the actual time
Debugging is often confused by thinking that what you observe is what
you intended.

e.g. (just an example) a Class with two field both called 'name' at
different levels of inheritance. You look at one, the code uses the other.

Regards

Ed Willink
Re: Exception when invoking a helper method [message #915382 is a reply to message #915119] Mon, 17 September 2012 07:11 Go to previous message
Rami D. is currently offline Rami D.Friend
Messages: 14
Registered: August 2012
Junior Member
Hi Ed,

i still didn't get it how to debug. I copied my eclipse instance and started the first eclipse with the given parameters. Then I've started the second eclipse instance and created a remote application using port 14143 with the gmf project as the source application. I've set a breakpoint at the beginning of my helper method in the Utils.qvto but when I generate the diagram code it doesn't stop there.
Did I miss something or what's going wrong?

Regards,
Rami
Previous Topic:Strange reference to UCharacter in RunnableQVTParser
Next Topic:QVTo editor with changing input model
Goto Forum:
  


Current Time: Fri Mar 29 10:06:51 GMT 2024

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

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

Back to the top