The problem is either in the way the arguments are copied over or the way getParameter(s) handle them. Not knowing the intent of the MultiPartFilter author it's not easy for me to decide.
What happens is, that when the parameters from the query string are copied over in the line:
MultiMap params = new MultiMap(request.getParameterMap());
then the MultiMapFilter.map will contain entries with a string as key and a string array as a value. E.g. the entry for x will have a String as key with value x and its value will be String[]
{"1"}
. After adding the form parameters to it the map will have
x String array with one element with value "1".
y Array with two entries:
[0] ist another String array with one element with value "2".
[1] is a byte array with value [0x50,0x50] (the parameter value "22").
z is a byte array with value [0x51,0x51] (the parameter value"33").
The MultiPart.Wrapper getParameter method fails in this way:
when it aks for the value for y it gets the array of array which it cannot handle, a it expects either single byte[] or String or an array of Strings.
It handles correctly the case of x=1 though.
The MultiPart.Wrapper getParameterValues method fails in this way:
When it asks for the value of x it gets an ArrayList containing the String-array. It iterates over the array list expecting only byte-arrays and strings in it and fails.
When it asks for the value of y it gets an ArrayList containing the String-array anf the byte-array. It iterates over the array list expecting only byte-arrays and strings in it and fails.
So the Wrapper get methods do not handle the map as it was constructed. There is either an error in the get methods or in the way the map is built in the first place.
This bug seems not to be fixes in a satisfactory way — or I did not understand what it is about. If I have this kind of form:
<form action='http://localhost:8080/dump/info?x=1&y=2' method='post'
enctype='multipart/form-data'>
<p><input type='text' size='80' name='y' value='22' /></p>
<p><input type='text' size='80' name='z' value='33' /></p>
<p><input type='submit' name='send' value='send' /></p>
</form>
and test this with jetty-6.1.21, i.e. I simply enter the jetty directory and start jetty with" java -jar start.jar" then the dump info page shows me:
Request Parameters:
z: 33
send: send
y: null
y[0]: null
y[1]: 22
x: 1
So the query parameters are somehow copies over, as you see x and two y (one from the query string, the other from the form input field). Yet the ones copied over from the query string have value null.