No such property: params for class: DUMMY when returning null value

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

No such property: params for class: DUMMY when returning null value

Krystian
Hi,

I've got a controller, which calls a method on a singleton class.
Here's the definition of the method:

  def User loginUser(String id) {
    User user = User.findByDeviceId(id)
    return user
  }

Now everything is fine when user instance is found.
However, when a null value is returned from the method, I am getting following exception:
groovy.lang.MissingPropertyException: No such property: params for class: DUMMY
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
        at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:241)
        at DUMMY$_closure1.doCall(DUMMY.groovy:1)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:80)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1070)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
        at com.test.Login.loginUser(Login.groovy:34)
[...]

Funny thing is, the exception is pointing at the return statement of the singleton class.

I am not sure what should I do about it as I have to return nulls from there to indicate user does not exist [it is just a test project, later on it will of course change].

Help will be appreciated.

Thank you,
Krystian

Reply | Threaded
Open this post in threaded view
|

Re: No such property: params for class: DUMMY when returning null value

ishe
try:

  def loginUser(String id) {
...

or

  User loginUser(String id) {
...



On Tue, 2010-07-20 at 03:12 -0700, Krystian [via Grails] wrote:

> Hi,
>
> I've got a controller, which calls a method on a singleton class.
> Here's the definition of the method:
>
>   def User loginUser(String id) {
>     User user = User.findByDeviceId(id)
>     return user
>   }
>
> Now everything is fine when user instance is found.
> However, when a null value is returned from the method, I am getting
> following exception:
> groovy.lang.MissingPropertyException: No such property: params for
> class: DUMMY
>         at
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
>         at
> org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:241)
>         at DUMMY$_closure1.doCall(DUMMY.groovy:1)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
>         at
> org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:80)
>         at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
>         at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058)
>         at
> groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1070)
>         at
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
>         at com.test.Login.loginUser(Login.groovy:34)
> [...]
>
> Funny thing is, the exception is pointing at the return statement of
> the singleton class.
>
> I am not sure what should I do about it as I have to return nulls from
> there to indicate user does not exist [it is just a test project,
> later on it will of course change].
>
> Help will be appreciated.
>
> Thank you,
> Krystian
>
>
>
>
> ______________________________________________________________________
> View message @
> http://grails.1312388.n4.nabble.com/No-such-property-params-for-class-DUMMY-when-returning-null-value-tp2295240p2295240.html 
> To start a new topic under Grails - user, email ml-node
> +[hidden email]
> To unsubscribe from Grails - user, click here.
>


Reply | Threaded
Open this post in threaded view
|

Re: No such property: params for class: DUMMY when returning null value

Krystian
Hi Igor,

thanks for the tip, I have removed 'def' and it worked :)

However, this exception was thrown only when I had a breakpoint set on the return user like in my method.
When BP was removed, it all went smooth.

Well... now it works with BP and without it :)

Thanks,
Krystian