[ 
https://issues.apache.org/jira/browse/WW-5792?focusedWorklogId=1049885&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1049885
 ]

ASF GitHub Bot logged work on WW-5792:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Oct/26 08:24
            Start Date: 24/Oct/26 08:24
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #2054:
URL: https://github.com/apache/struts/pull/2054

   Fixes [WW-5792](https://issues.apache.org/jira/browse/WW-5792)
   
   ## Problem
   
   `XmlDocConfigurationProvider#verifyAction` threw 
`ConfigurationException("... is not public")` inside a `try` whose `catch 
(RuntimeException)` handler swallowed it. A non-public action class therefore 
loaded with only a misleading INFO line ("Unable to verify action class ... 
exists at initialization").
   
   ## Change
   
   - A non-public action class now logs a WARN with the class name and config 
location, saying it will fail startup in Struts 8.0.0. The method then returns.
   - Returning skips `getConstructor()`, just as the old swallowed throw did. 
Without that, a package-private class, whose implicit constructor is 
package-private too, would fail with "does not have a public no-arg 
constructor". That would break startup for apps that work today, which is what 
7.5.0 should not do.
   - Startup behaviour is unchanged otherwise. The default `ObjectFactory` can 
still build these actions through `ContainerImpl`'s `setAccessible(true)`.
   - Added a core test for the non-public branch. There was none before.
   
   Failing startup is deferred to 8.0.0 in 
[WW-5809](https://issues.apache.org/jira/browse/WW-5809), which matches the 
Struts Boot registry provider (WW-5791).
   
   7.5.0 migration notes owe one line: non-public XML action classes now log a 
warning and will fail startup in 8.0.0.
   
   ## Testing
   
   - `XmlConfigurationProviderActionsTest#testNonPublicActionWarnsAndLoads` 
failed before the fix (no WARN) and passes after it.
   - Full `core` suite: 3545 tests, 0 failures.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)




Issue Time Tracking
-------------------

            Worklog Id:     (was: 1049885)
    Remaining Estimate: 0h
            Time Spent: 10m

> XmlDocConfigurationProvider#verifyAction does not fail startup for a 
> non-public action class
> --------------------------------------------------------------------------------------------
>
>                 Key: WW-5792
>                 URL: https://issues.apache.org/jira/browse/WW-5792
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.5.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> h2. Problem
> {{XmlDocConfigurationProvider#verifyAction}} is meant to fail fast when an 
> action class declared in XML is not public. It throws a 
> {{ConfigurationException}} with the message "Action class [...] is not 
> public" — but the throw happens inside the same {{try}} block whose {{catch 
> (RuntimeException ex)}} handler logs at INFO ("Unable to verify action class 
> [...] exists at initialization") and carries on. {{ConfigurationException}} 
> extends {{StrutsException}}, which extends {{RuntimeException}}, so the check 
> never takes effect and startup continues.
> The sibling check works: a class without a public no-arg constructor raises 
> {{NoSuchMethodException}}, which has its own handler that rethrows as 
> {{ConfigurationException}}.
> h2. Reproduction
> Calling {{verifyAction}} (with the default {{ObjectFactory}}, so 
> {{isNoArgConstructorRequired()}} is true) on:
> * a package-private action class → returns normally, nothing but an INFO log 
> line;
> * a public class without a public no-arg constructor → throws 
> {{ConfigurationException: Action class [...] does not have a public no-arg 
> constructor}}.
> Confirmed on {{main}} with a throwaway test in 
> {{org.apache.struts2.config.providers}} that injects a 
> {{StrutsXmlConfigurationProvider}} from the test container and calls 
> {{verifyAction}} directly for both classes.
> h2. Expected
> A non-public action class logs a WARN naming the class and its location, 
> saying it will fail startup in Struts 8.0.0. Configuration loading continues 
> as before. Failing startup is tracked in WW-5809 (8.0.0).
> h2. Notes
> Found while adding the same check to the Struts Boot registry provider 
> (WW-5791), which fails startup for non-public action classes. There is 
> currently no core test for the non-public branch.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to