[#1111] Click fork: stop calling javax.servlet-bound upstream ClickUtils - #1112
[#1111] Click fork: stop calling javax.servlet-bound upstream ClickUtils#1112maximthomas wants to merge 2 commits into
Conversation
…und upstream ClickUtils The fork is compiled against jakarta.servlet, but click-nodeps 2.3.0 is not: upstream ClickUtils.getLogService() resolves a javax.servlet.Servlet- Context that is absent from the classpath, and reads a thread local that only the upstream servlet populates. Route these calls to the fork's own ClickUtils.getLogService() instead. ContainerUtils imported org.apache.click.util.ClickUtils, shadowing the same-package fork class, so its unqualified call resolved upstream too. Its LogService import is repointed as well: the upstream interface is javax.servlet-bound via onInit(ServletContext). No behaviour change; nothing reaches this code today.
Code reviewReviewed the diff, compiled 1. The sweep is incomplete in the file it edits —
|
…ContainerUtils, ClickUtils, ErrorReport ErrorReport fully-qualified org.apache.click.util.ClickUtils at seven sites. Unlike the rest, it is reachable (ErrorPage, VelocityTemplateService), so the fork kept a hard reference into the javax.servlet-compiled jar in live code. De-qualified onto the fork's own getBundle/escapeHtml. ContainerUtils imported upstream Button and Label, which extend upstream Field, so every instanceof filter was permanently false for fork controls. Repointed. FieldSet has no fork equivalent, so its guard was always true and is dropped. ClickUtils imported upstream ActionLink, making the getCssSelector branch at :1461 dead for every control the fork can produce. getConfigService's failure message told operators to register org.apache.click.ClickServlet, which never sets the fork's ConfigService attribute -- following it made the failure permanent.
|
Fixed items 1, 3, 4 and 7 in 21c3743; description corrected for item 2. Notes on what I verified, and two places where the picture turned out different. 4 — The finding was right, but "those two methods happen to be servlet-free today, which is the only reason it works" doesn't hold: it wasn't working. Upstream
The allowlist needs correcting before #1110 uses it. Same probe:
1 — control imports. Fixed: One correction on the consequences. Nothing instantiates a fork 2 —
3 — 7 — diagnostic. Fixed, and it was worse than stated: 5 and 6 — not taken. Correct readings, but Still open, found while verifying the above — logging rather than fixing here: Build-time guard. Agreed, and this exchange is the argument for it — careful manual inspection produced an allowlist that was wrong on three of four entries. It will be handled as part of #1110. Verification is bytecode plus the probe above, since the fork has no tests: |
The fork is compiled against jakarta.servlet, but click-nodeps 2.3.0 is not: upstream ClickUtils.getLogService() resolves a javax.servlet.Servlet- Context that is absent from the classpath, and reads a thread local that only the upstream servlet populates. Route these calls to the fork's own ClickUtils.getLogService() instead.
ContainerUtils imported org.apache.click.util.ClickUtils, shadowing the same-package fork class, so its unqualified call resolved upstream too. Its LogService import is repointed as well: the upstream interface is javax.servlet-bound via onInit(ServletContext).
No behaviour change; nothing reaches this code today.
fixes #1111 issue