[
https://issues.apache.org/jira/browse/WW-4793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15990612#comment-15990612
]
ASF GitHub Bot commented on WW-4793:
------------------------------------
GitHub user sdutry opened a pull request:
https://github.com/apache/struts/pull/136
WW-4793 only add JBossFileManager when supported
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/sdutry/struts WW-4793
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/struts/pull/136.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #136
----
commit f7beeacf400ec6bdb27a7d67deb3b55dcc0f5dac
Author: Stefaan Dutry <[email protected]>
Date: 2017-05-01T05:54:19Z
added utility innerclass for checking support
commit 4be974a482a2894b677ee4d2292ec778dfcd429e
Author: Stefaan Dutry <[email protected]>
Date: 2017-05-01T06:00:54Z
only add JBossFileManager when it's supported
commit b140218cf2c7c634a6c42cd859d6d3b81cb5c290
Author: Stefaan Dutry <[email protected]>
Date: 2017-05-01T06:06:11Z
removed redundant logger declaration
----
> Don't add JBossFileManager as a possible FileManager when not on JBoss
> ----------------------------------------------------------------------
>
> Key: WW-4793
> URL: https://issues.apache.org/jira/browse/WW-4793
> Project: Struts 2
> Issue Type: Improvement
> Components: Core
> Affects Versions: 2.5.10
> Reporter: Stefaan Dutry
> Priority: Trivial
>
> When the application starts and there is no FileManager specified as
> initParam, the {{JBossFileManager}} gets added.
> This results in the check happening everytime a FileManager is requested.
> (When turning on logging, i can see it happening 12 times when starting a
> simple application)
> {code:java|title=org.apache.struts2.dispatcher.Dispatcher}
> ...
> private void init_FileManager() throws ClassNotFoundException {
> if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER)) {
> ...
> } else {
> // add any other Struts 2 provided implementations of FileManager
> configurationManager.addContainerProvider(new
> FileManagerProvider(JBossFileManager.class, "jboss"));
> }
> ...
> }
> ...
> {code}
> {code:java|title=com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory}
> private FileManager lookupFileManager() {
> Set<String> names = container.getInstanceNames(FileManager.class);
> ...
> for (FileManager fm : internals) {
> if (fm.support()) {
> return fm;
> }
> }
> return null;
> }
> {code}
> My suggestion would be to not add it if it's not supported.
> I don't know what the best way to do this would be.
> The possibility i was thinking of so far involves the following:
> * Creating a seperate utility class to check if it can support it
> ** perhaps a public static innerclass of {{JBossFileManager}} with public
> static method(s) to check it?
> ** or a seperate class (although i think this might be awkward)
> * adding a test around adding the JBossFileManager to only do it when it
> could be supported.
> additional information:
> * log messages were noticed by adjusting the log4j2 configuration in the
> {{form-processing}} application from {{struts-examples}} and starting it.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)