sbglasius commented on PR #16281: URL: https://github.com/apache/grails-core/pull/16281#issuecomment-5490884194
Thanks @matrei — confirmed and fixed in 0093ab2. I verified the failure path before acting on it: `Controller.initializeCommandObject()` passes `params.getIdentifier()` straight into `InvokerHelper.invokeStaticMethod(type, 'get', entityIdentifierValue)` at `grails-controllers/src/main/groovy/grails/artefact/Controller.groovy:377`, so `?id=1&identifier=2` really did resolve to entity `2`. That was a regression I introduced, not something the issue asked for. `getIdentifier()` is restored to `return get(GormProperties.IDENTITY);`, with a javadoc note explaining why it deliberately ignores an `identifier` parameter, so this does not get "helpfully" reintroduced later. The map-access fix is untouched and still delivers what #16280 asked for — `params.identifier = '123'`, `params['identifier']` and `params.identifier` all address the map entry. Added the regression test you asked for: `CommandObjectInstantiationSpec > 'Test a parameter named identifier does not divert domain command object resolution'`. It saves two domain objects, submits `id=target.id` with `identifier=decoy.id`, and asserts the command object resolves to the target while `params['identifier']` still reads the decoy value. I confirmed it **fails** with the old implementation reinstated and passes with the fix, so it is a real guard rather than a tautology. Docs updated to match: `upgrading80x.adoc` §28.3 no longer lists a `getIdentifier()` behavior change, and the `controllersAndScopes.adoc` note now states that `getIdentifier()` always reads `id`. Re-verified locally: `:grails-test-suite-web:test`, `:grails-web-common:test`, `:grails-core:test`, `:grails-taglib:test`, `:grails-controllers:test` (all with `--rerun-tasks`), and `aggregateViolations` reports no Checkstyle, CodeNarc, PMD or SpotBugs issues. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
