[
https://issues.apache.org/struts/browse/WW-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44818#action_44818
]
Himanshu commented on WW-2713:
------------------------------
This bug may sound minor from the context in which it was filed. This bug can
produce fatal consequences when using Struts 2 with JBoss 4.2.3 and the
developer is relying on default JBoss logging capabilities i.e JBoss is not
picking up the web application log4j.properties or JBoss has not been
instructed to use the application's log4j.prop.
The JBoss root logger in default configuration
(server/default/conf/jboss-log4j.xml) does not specify a logging level and in
log4j, the default logging level is default for root loggers. Hence, the
application begins to use default logging. The ParametersInterceptor begins to
print out the value of the parameters since default logging is enabled. If a
parameter's value is an empty array (or an array of size 0 i.e new int[0]),
then you will see this exception. I hope this bug will be fixed. The fix is
simple in ParametersInterceptor.getParameterLogMap: print an empty value for a
zero size parameter explicitly instead of attempting to construct it via the
innermost for loop. Since it is a logging method, I think the struts people can
afford to sneak it into the next release/service pack.
Current workarounds: Change logging level for for the ParametersInterceptor
class in jboss-log4j.xml file or make JBoss pick up your own log4j
configuration file.
> ParametersInterceptor: IndexOutOfBoundsException while logging parameters
> -------------------------------------------------------------------------
>
> Key: WW-2713
> URL: https://issues.apache.org/struts/browse/WW-2713
> Project: Struts 2
> Issue Type: Bug
> Components: Core Interceptors
> Affects Versions: 2.0.11.1
> Environment: Struts 2.0.11.1, Eclipse, Unit Test
> Reporter: Eduard Papa
> Priority: Minor
>
> I had written a unit test which was running successfully until I turned on
> DEBUG level in log4j. This caused the unit test to fail and I tracked down
> the problem to the ParametersInterceptor, line 241 in xwork-2.0.4.jar:
> logEntry.append(String.valueOf(valueArray[valueArray.length - 1]));
> The value array there can be empty (0-length) and that line will try to
> access valueArray[-1] which causes the exception.
> I don't know if the user can submit input that would result in a request
> parameter with an empty array, so this might not be an issue in production
> applications, but I think it should be fixed for the sake of making the
> ParametersInterceptor more robust, in case anyone wants to test request
> parameters with empty arrays.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.