New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grails 6.2.0 - Cast Exception if Action takes Command #13486
Comments
That is interesting! Could you also post the generated code when the variable is renamed? |
This behavior wasn't present in our project for Grails 5.x. We first noticed it when we updated to Grails 6.x. |
FYI: I ran into this too. I found that if I use the method parameter name 'cmd' for the command object, then it fails:
produces the org.codehaus.groovy.runtime.typehandling.GroovyCastException when I call save(). But when changing the parameter named to 'acmd', everything works as expected:
|
I've learned a bit more... it is not JUST the name. I have another case where the name of the parameter is 'cmd' and it works just fine. |
Expected Behavior
After upgrading to Grails 6.2.0, one of our controllers started to error. I was able to reproduce this issue in a sample application. Visiting http://localhost:8080/example/list should render the list action renders without issue. Instead an exception is thrown.
Changing a variable name in an unrelated action fixes the issue.
Actual Behaviour
A class cast exception occurs:
Cannot cast object 'brokenBinding.ExampleSearchCommand@116e5496' with class 'brokenBinding.ExampleSearchCommand' to class 'brokenBinding.ExampleCommand'
Steps To Reproduce
Details in README.md
Environment Information
Example Application
https://github.com/jdaugherty/grails-broken-binding
Version
6.2.0
The text was updated successfully, but these errors were encountered: