Issue Details (XML | Word | Printable)

Key: FILEUPLOAD-4
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: P. Eymann
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons FileUpload

[fileupload] The common upload functions do not work on z/OS WebSphere

Created: 16/Jan/04 10:05 PM   Updated: 09/Mar/07 08:31 PM
Return to search
Component/s: None
Affects Version/s: 1.0 Final
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
Operating System: other
Platform: Other

Bugzilla Id: 26194


 Description  « Hide
The FileUploadBase class uses the default platform encoding when getting the
content-type header attribute in order to determine the boundary value for a
multi-part request.

Method public List parseRequest(HttpServletRequest req) ::
...
String contentType = req.getHeader(CONTENT_TYPE);
...
byte[] boundary = contentType.substring(boundaryIndex + 9).getBytes();

This does not work on z/OS Websphere 4 (and maybe on other platforms) because
the request encoding is not similar to the platform encoding (CP1047) and thus
the corresponding bytes are not the same. As a consequence, the FileUpload
class does not find any request "parts", because the MultiPartStream class
performs a search on binary data with the wrong (local platform) bytes (see
findSeparator method).

This can be corrected by adding an encoding parameter to the getBytes() method
in the FileUploadBase class :
byte[] boundary = contentType.substring(boundaryIndex + 9).getBytes("ISO-8859-
1");
(This happens twice in this class)

Maybe I missed something but I think a server cannot determine the encoding
used by the browser to build the request headers, so this cannot be dynamically
setup during runtime. I would think the only "reasonable" way would be to use
the "headerEncoding" optional member :

byte[] boundary = null;
if (getHeaderEncoding() != null)
boundary = contentType.substring(boundaryIndex + 9).getBytes
(getHeaderEncoding());
else
boundary = contentType.substring(boundaryIndex + 9).getBytes();

Philippe.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.