codeconsole commented on PR #16272:
URL: https://github.com/apache/grails-core/pull/16272#issuecomment-5822106822
Thanks @matrei, all five are addressed in the push up to `e81621a6c2`.
1. **A resource link naming its `controller`** (`031440d091`): such a link
no longer resolves the controllers serving the domain class, so it reports no
ambiguity and pays for no resolution. The namespace a resolved link carries now
applies whenever the link was resolved, so `controller: ''` resolves as an
absent attribute does throughout. Tests cover no warning with an explicit
`controller`, and a blank-versus-absent case where the name alone is ambiguous
(`print` and `archive` `PamphletsController`, only one of which has `show`),
which failed before.
2. **The reported-once sets** (`bf9c544d5b`): both now live in
`ControllerIndex`, so they are discarded with it whenever the controllers
change; `resetControllerNamespaceCache()` just drops the index. The tests
reload a controller on a plain `DefaultLinkGenerator` and assert the warning is
logged again.
3. **An unknown controller name keeps the request namespace**: I've kept
this. It is what makes a link and a redirect to the same unqualified name
agree, and a redirect to an unknown name has always stayed in the issuing
namespace (7.0.x put the issuing controller's `namespace` on every redirect
naming none). Falling back only in `redirect` would bring back the
link/redirect split for exactly those names. `2edef2b164` spells out where it
shows in the upgrade notes: a namespaced controller's unit test usually
registers no other controller, so `g.createLink(controller: 'other', ...)`
there now includes the namespace, and the fix is to register that controller or
pass `namespace`. Agreed that this is the part to call out explicitly in the
list discussion.
4. **`issuingNamespace` stored as an `Object`** (`cfbaf5c52a`):
`resolveNamespace(Class)` now returns a `String`, with `?.toString()` on the
static-field fallback. `ControllerRedirectSpec` reads the namespace through
`GrailsWebRequest.controllerNamespace`, as link generation does, and a
controller declaring its namespace as a `GString` threw the
`ClassCastException` there before the fix.
5. **`LogCapture`** (`e87bbf388f`): `testFixtures(project(':grails-core'))`
in `grails-web-url-mappings`, with `slf4j-simple` and `simplelogger.properties`
replaced by a `logback-test.xml` holding `<root level="WARN"/>`. The specs read
`logCapture.events` for `DefaultLinkGenerator`.
I also renamed the private `getControllerIndex()` to
`currentControllerIndex()` (`d142808b20`): it shared a name with the
`controllerIndex` field it rebuilds, so rewriting a call as property access
would have skipped the rebuild.
--
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]