You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "codeconsole (via GitHub)" <gi...@apache.org> on 2025/10/16 21:50:09 UTC

[I] 7.0.0-RC2 - Strange Binding Issue [grails-core]

codeconsole opened a new issue, #15147:
URL: https://github.com/apache/grails-core/issues/15147

   ### Expected Behavior
   
   this worked fine in every version prior to 7.0.0-RC2
   
   ```groovy
   "/contests/$id/submit(.$format)?" (controller: 'contest', action:'submit')
   ```
   
   ```groovy
   class ContestController {
       def submit(long id, long images) {}
   }
   ```
   
   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:
   ```groovy
   class ContestController {
       def submit(long id, long images) {}
   }
   ```
   
   ### Actual Behaviour
   
   _No response_
   
   ### Steps To Reproduce
   
   _No response_
   
   ### Environment Information
   
   _No response_
   
   ### Example Application
   
   _No response_
   
   ### Version
   
   7.0.0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 7.0.0-RC2 - Strange Controller Binding Issue [grails-core]

Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on issue #15147:
URL: https://github.com/apache/grails-core/issues/15147#issuecomment-3418801107

   https://github.com/apache/grails-core/pull/14960


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 7.0.0-RC2 - Strange Controller Binding Issue [grails-core]

Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on issue #15147:
URL: https://github.com/apache/grails-core/issues/15147#issuecomment-3418803096

   There was a similar issue previously https://github.com/apache/grails-core/issues/13486


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 7.0.0-RC2 - Strange Controller Binding Issue [grails-core]

Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on issue #15147:
URL: https://github.com/apache/grails-core/issues/15147#issuecomment-3418792162

   https://github.com/apache/grails-core/commit/7c56295d6beb8f731dbabf310acf59aaf9b7788e


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 7.0.0-RC2 & 7.0.0 BUG - ControllerActionTransformer - GroovyCastException binding objects to controller method arguments. [grails-core]

Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley closed issue #15147: 7.0.0-RC2 & 7.0.0 BUG - ControllerActionTransformer - GroovyCastException binding objects to controller method arguments. 
URL: https://github.com/apache/grails-core/issues/15147


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 7.0.0-RC2 & 7.0.0 BUG - ControllerActionTransformer - GroovyCastException binding objects to controller method arguments. [grails-core]

Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on issue #15147:
URL: https://github.com/apache/grails-core/issues/15147#issuecomment-3418824774

   This revert fixes everything in this issue
   https://github.com/apache/grails-core/pull/15152


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 7.0.0-RC2 & 7.0.0 BUG - ControllerActionTransformer - GroovyCastException binding objects to controller method arguments. [grails-core]

Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on issue #15147:
URL: https://github.com/apache/grails-core/issues/15147#issuecomment-3432780079

   Fixed by 15153


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 7.0.0-RC2 - Strange Controller Binding Issue [grails-core]

Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on issue #15147:
URL: https://github.com/apache/grails-core/issues/15147#issuecomment-3417465235

   Another occurrence
   ```groovy
   "/$controller/$action?/$id?(.$format)?"
   ```
   ```groovy
   def prepareQuestionnaire(Long id) {
   }
   ```
   ```
   org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '1000271' with class 'java.lang.String' to class 'java.lang.Long'
   at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache ( org/codehaus.groovy.vmplugin.v8/IndyInterface.java:321 )
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 7.0.0-RC2 & 7.0.0 BUG - ControllerActionTransformer - GroovyCastException binding objects to controller method arguments. [grails-core]

Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on issue #15147:
URL: https://github.com/apache/grails-core/issues/15147#issuecomment-3423205014

   @jdaugherty you should be able to replicate via a simple controller
   
   ```groovy
   package data.binding.bug
   
   import grails.converters.JSON
   
   class TestController {
   
       def show(String id) { // success
           render([success: true] as JSON)
       }
   
       def submit(long id, long imageId) { // error: Cannot cast object '###' with class 'java.lang.String' to class 'long'.
           render([success: true] as JSON)
       }
   
       def dq(Long id, Long imageId) {  // error: Cannot cast object '###' with class 'java.lang.String' to class 'long'.
           render([success: true] as JSON)
       }
   }
   ```
   
   ```
   curl "http://localhost:8080/test/submit/123456789.json?imageId=123456789"
   ```
   
   ```
   2025-10-20T11:07:28.035-07:00 ERROR 34235 --- [nio-8080-exec-4] o.g.web.errors.GrailsExceptionResolver   : GroovyCastException occurred when processing request: [GET] /test/submit/123456789.json - parameters:
   imageId: 123456789
   Cannot cast object '123456789' with class 'java.lang.String' to class 'long'. Stacktrace follows:
   
   java.lang.reflect.InvocationTargetException: null
           at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:110)
           at org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker.invoke(DefaultGrailsControllerClass.java:215)
           at org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:192)
           at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:110)
           at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
           at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
           at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
           at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
           at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
           at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:80)
           at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:70)
           at java.base/java.lang.Thread.run(Thread.java:1447)
   Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '123456789' with class 'java.lang.String' to class 'long'
           at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
           ... 11 common frames omitted
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org