Home » Modeling » UML2 » Error when using getValue(): Illegal argument exception
|
Re: Error when using getValue(): Illegal argument exception [message #1083910 is a reply to message #1082934] |
Sat, 10 August 2013 18:08 |
|
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 |
Javier García 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 |
|
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
|
|
| | | |
Goto Forum:
Current Time: Thu Apr 25 01:56:45 GMT 2024
Powered by FUDForum. Page generated in 0.02845 seconds
|