Skip to content

7.0.0-RC2 & 7.0.0 BUG - ControllerActionTransformer - GroovyCastException binding objects to controller method arguments.  #15147

@codeconsole

Description

@codeconsole

This commit introduced biding exceptions on several methods in my Controller, but not all of them.

Summary

Inconstant binding resulting in GroovyCastExceptions

class ContestController {
    def dq(long id, long imageId) {}  // WORKS FINE!
    def submit(long id, long images) {} // GroovyCastException: Cannot cast object '1000311' with class 'java.lang.String' to class 'long'
    def prepareQuestionnaire(Long id) { // GroovyCastException: Cannot cast object '1000271' with class 'java.lang.String' to class 'java.lang.Long'
}

this worked fine until August 7th

class ContestController {
    def submit(long images) { params.long('id')} 
}

results in

2025-10-16T10:15:25.907-07:00 ERROR 69893 --- [cat-handler-402] 
o.g.web.errors.GrailsExceptionResolver   : Cannot cast object '1000311' with class 'java.lang.String' to class 'long'
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '1000311' with class 'java.lang.String' to class 
'long'
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) 

which is weird because there is not a complete stack trace.

Workaround:

class ContestController {
    def submit(long id, long images) {}
}

No response

Example Application

I am unable to replicate this in an example app and there are other similar situations in my app that work fine.

Version

7.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions