Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Error when using getValue(): Illegal argument exception
icon9.gif  Error when using getValue(): Illegal argument exception [message #1082934] Fri, 09 August 2013 08:20 Go to next message
Javier García is currently offline Javier GarcíaFriend
Messages: 129
Registered: April 2013
Senior Member
Hi everyone,
I'm getting an exception when trying to use the method getValue(Stereotype, String) to get the value of the applied stereotype.
The code is something like:
aClass.getValue(aClass.getAppliedStereotypes().first(), property.name)

And the exception says "illegal argument exception".

I'm sure that the class has an stereotype applied and that the property name exists (because I can use setValue without a problem), so I don't know if you guys have any idea about what could be the issue because it doesn't make much sense to me.
I'm using ATL so I asked in their forums but thought that maybe I could also get some help here.

So anyways, if I can't use getValue, is there something else I could use? I was thinking that maybe something like StereotypeApplication.attributes or something like that.

thanks in advance,
regards,
Javier
Re: Error when using getValue(): Illegal argument exception [message #1083910 is a reply to message #1082934] Sat, 10 August 2013 18:08 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Javier,

The property.name must be exactly the name of a property of the
stereotype in question. How do you know which stereotype to expect that

aClass.getAppliedStereotypes()

will return? AFAIK, the collection of stereotypes is unordered, so if
there are multiple stereotypes applied, you can't know which will be
the first. It is probably better to use

aClass.getAppliedStereotype('<profile-name>::<stereotype-name>')

to get the stereotype by its qualified name.

Note that if there aren't actually any stereotypes applied to 'aClass'
then, then probably first() returns null and that will also result in
IAE. That is worth double-checking. One common way for the applied
stereotypes collection to compute empty when it shouldn't is if the
contextual ResourceSet cannot resolve/load the profile that defines the
stereotype(s).

HTH,

Christian


On 2013-08-09 08:20:57 +0000, Javier García said:

> Hi everyone,
> I'm getting an exception when trying to use the method
> getValue(Stereotype, String) to get the value of the applied
> stereotype. The code is something like:
> aClass.getValue(aClass.getAppliedStereotypes().first(), property.name)
> And the exception says "illegal argument exception".
>
> I'm sure that the class has an stereotype applied and that the property
> name exists (because I can use setValue without a problem), so I don't
> know if you guys have any idea about what could be the issue because it
> doesn't make much sense to me.
> I'm using ATL so I asked in their forums but thought that maybe I could
> also get some help here.
>
> So anyways, if I can't use getValue, is there something else I could
> use? I was thinking that maybe something like
> StereotypeApplication.attributes or something like that.
>
> thanks in advance,
> regards,
> Javier
Re: Error when using getValue(): Illegal argument exception [message #1084856 is a reply to message #1083910] Mon, 12 August 2013 06:32 Go to previous messageGo to next message
Javier García is currently offline Javier GarcíaFriend
Messages: 129
Registered: April 2013
Senior Member
Hi Christian,
you are right, I was doing something wrong when getting the stereotype and the property name.
I have a different problem now though, I get this exception:
Quote:
org.eclipse.m2m.atl.engine.emfvm.VMException: Operation getValue: wrong number of parameters
at __applyModelFromIN#192(PSM2Final.atl[109:55-110:55])
local variables: self=PSM2Final : ASMModule, link=TransientLink {rule = ModelFromIN, sourceElements = {s = org.eclipse.uml2.uml.internal.impl.ModelImpl@a32204 (name: org.dews_online.ccui.core, visibility: <unset>) (viewpoint: <unset>)}, targetElements = {t = org.eclipse.uml2.uml.internal.impl.ModelImpl@b86b8b (name: org.dews_online.ccui.core, visibility: <unset>) (viewpoint: <unset>)}, variables = {}}, s=IN!org.dews_online.ccui.core, t=OUT!org.dews_online.ccui.core, property=Profile!workbenchAction
at __exec__#8(PSM2Final.atl)
local variables: self=PSM2Final : ASMModule, e=TransientLink {rule = ModelFromIN, sourceElements = {s = org.eclipse.uml2.uml.internal.impl.ModelImpl@a32204 (name: org.dews_online.ccui.core, visibility: <unset>) (viewpoint: <unset>)}, targetElements = {t = org.eclipse.uml2.uml.internal.impl.ModelImpl@b86b8b (name: org.dews_online.ccui.core, visibility: <unset>) (viewpoint: <unset>)}, variables = {}}
at main#63(PSM2Final.atl)
local variables: self=PSM2Final : ASMModule


Wrong number of parameters.
The code I'm using is:
s.getValue(profile!Stereotype.allInstances().asSequence() -> select(i | i.qualifiedName = 'RCP::Workbench'), 'perspectives')

I don't understand this error at all, I'm giving an Stereotype and a String which is the name of a property of this stereotype, and I know the stereotype is applied because I check it beforehand, I don't real know what to do.

Thanks for your help
regards
Javier
Re: Error when using getValue(): Illegal argument exception [message #1089401 is a reply to message #1084856] Sun, 18 August 2013 17:36 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Javier,

I don't know how to interpret ATL stack traces, nor why the ATL
transformation is trying to pass the wrong number of arguments to the
Element::getValue(...) operation (if, indeed, that is even the actual
problem). Probably the ATL newsgroup can help to sort that out.
Perhaps the problem is in some third-party code? (what is the
org.dews_online.ccui.core namespace?)

Cheers,

Christian


On 2013-08-12 06:32:49 +0000, Javier García said:

> Hi Christian,
> you are right, I was doing something wrong when getting the stereotype
> and the property name.
> I have a different problem now though, I get this exception:
> Quote:
>> org.eclipse.m2m.atl.engine.emfvm.VMException: Operation getValue: wrong
>> number of parameters
>> at __applyModelFromIN#192(PSM2Final.atl[109:55-110:55])
>> local variables: self=PSM2Final : ASMModule, link=TransientLink {rule
>> = ModelFromIN, sourceElements = {s =
>> org.eclipse.uml2.uml.internal.impl.ModelImpl@a32204 (name:
>> org.dews_online.ccui.core, visibility: <unset>) (viewpoint: <unset>)},
>> targetElements = {t =
>> org.eclipse.uml2.uml.internal.impl.ModelImpl@b86b8b (name:
>> org.dews_online.ccui.core, visibility: <unset>) (viewpoint: <unset>)},
>> variables = {}}, s=IN!org.dews_online.ccui.core,
>> t=OUT!org.dews_online.ccui.core, property=Profile!workbenchAction
>> at __exec__#8(PSM2Final.atl)
>> local variables: self=PSM2Final : ASMModule, e=TransientLink {rule =
>> ModelFromIN, sourceElements = {s =
>> org.eclipse.uml2.uml.internal.impl.ModelImpl@a32204 (name:
>> org.dews_online.ccui.core, visibility: <unset>) (viewpoint: <unset>)},
>> targetElements = {t =
>> org.eclipse.uml2.uml.internal.impl.ModelImpl@b86b8b (name:
>> org.dews_online.ccui.core, visibility: <unset>) (viewpoint: <unset>)},
>> variables = {}}
>> at main#63(PSM2Final.atl)
>> local variables: self=PSM2Final : ASMModule
>
>
> Wrong number of parameters.
> The code I'm using is:
> s.getValue(profile!Stereotype.allInstances().asSequence() -> select(i |
> i.qualifiedName = 'RCP::Workbench'), 'perspectives')
> I don't understand this error at all, I'm giving an Stereotype and a
> String which is the name of a property of this stereotype, and I know
> the stereotype is applied because I check it beforehand, I don't real
> know what to do.
>
> Thanks for your help
> regards
> Javier
Re: Error when using getValue(): Illegal argument exception [message #1089785 is a reply to message #1089401] Mon, 19 August 2013 08:36 Go to previous messageGo to next message
Javier García is currently offline Javier GarcíaFriend
Messages: 129
Registered: April 2013
Senior Member
Hi Christian,
I asked also in the ATL forums but I thought it'd be worth a try to ask here too.
The only things used here are the ATL transformation module and the UML model, so the problem is either in ATL or in UML.
I'm guessing what you say is right, ATL must be somehow sending the wrong number of parameters so the problem probably isn't with UML but with ATL, I will keep checking and let you know if I find a solution.

Thanks for your help,
regards,
Javier
Re: Error when using getValue(): Illegal argument exception [message #1090445 is a reply to message #1082934] Tue, 20 August 2013 06:22 Go to previous messageGo to next message
Javier García is currently offline Javier GarcíaFriend
Messages: 129
Registered: April 2013
Senior Member
Ok problem solved, I created a method called getValue on one of the libraries I was using so the compilr got confused.
Re: Error when using getValue(): Illegal argument exception [message #1090626 is a reply to message #1090445] Tue, 20 August 2013 12:20 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Ah, very good! Thanks for reporting this follow-up. It sounds like a
good bug report for ATL :-)

cW

On 2013-08-20 06:22:22 +0000, Javier García said:

> Ok problem solved, I created a method called getValue on one of the
> libraries I was using so the compilr got confused.
Previous Topic:Ordering in Sequence Diagrams
Next Topic:Problem serialization of own UML ModelImpl
Goto Forum:
  


Current Time: Thu Apr 25 11:04:56 GMT 2024

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

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

Back to the top