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



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.

Reply via email to