[jboss-jira] [JBoss JIRA] Commented: (JBPORTAL-1095) Failure in producer form processing when using array of parameters

Chris Laprun (JIRA) jira-events at jboss.com
Tue Oct 31 18:02:41 EST 2006


    [ http://jira.jboss.com/jira/browse/JBPORTAL-1095?page=comments#action_12346048 ] 
            
Chris Laprun commented on JBPORTAL-1095:
----------------------------------------

The fix was almost right... In fact, arrayCopy needed to copy valuesLenght and not valuesLength -1 as well... I don't know what I was on when I wrote the code but, boy, did it ever suck! :)
This is now covered by a test case.

> Failure in producer form processing when using array of parameters
> ------------------------------------------------------------------
>
>                 Key: JBPORTAL-1095
>                 URL: http://jira.jboss.com/jira/browse/JBPORTAL-1095
>             Project: JBoss Portal
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Portal WSRP
>    Affects Versions: 2.4 Final
>         Environment: JBoss Portal 2.4
>            Reporter: Sten Roger Sandvik
>         Assigned To: Chris Laprun
>            Priority: Blocker
>             Fix For: 2.4.1 Final, 2.6.Alpha1
>
>
> I encountered an ArrayIndexOutOfBoundsException in processing of form parameters. It only happens when multiple parameters with same name is submitted. Encountered on line 369 in org.jboss.portal.wsrp.producer.MarkupHandler.java
> Line 364 in org.jboss.portal.wsrp.producer.MarkupHandler.java
> ---------------------------------------------------------------------------------------
>                 // handle multi-valued parameters...
>                String[] oldValues = (String[])params.get(paramName);
>                int valuesLength = oldValues.length;
>                String[] newValues = new String[valuesLength];
>                System.arraycopy(oldValues, 0, newValues, 0, valuesLength - 1);
>                newValues[length] = paramValue;
>                params.put(paramName, newValues);
> Should be:
> ---------------
>                // handle multi-valued parameters...
>                String[] oldValues = (String[])params.get(paramName);
>                int valuesLength = oldValues.length;
>                String[] newValues = new String[valuesLength + 1];
>                System.arraycopy(oldValues, 0, newValues, 0, valuesLength - 1);
>                newValues[valuesLength] = paramValue;
>                params.put(paramName, newValues);

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list