ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | enhydra List | September 2005 Index

<--  Date Index  --> <--  Thread Index  -->

Possible Bug in MultiPartMimeInputStream


Hi!

I found something that i think is bug: in MultipartMimeInputStream when
reading the headers of a multipart request, the byte are autamatically
transformed in String instead of using the correct encoding. This happen
in 5.4.1 and the last enhydra version from CVS (6.5.1?).
The problem is the headers in multipart request have usefull information
like the file name. Not using the correct encoding to transform the
bytes to a String, made the file name appears wtih strange chars on it.

For enhydra 5.4.1 a made a little patch: i just changed one line in the
constructor and added the necessary import.
I changed the line:
String line = new String(bytesToChars(lineBuf,0,n));
to:
String line = new String(lineBuf,0,n,HttpUtils.ENCODING);
And added the:
import javax.servlet.http.HttpUtils;

Now it works well. :)

For 6.5.1 i did not made a patch but it should be something similar like
changing the same line to:
String line = new String(lineBuf,0,n,
comms.request.getHttpServletRequest().getCharacterEncoding());
and add the necessary imports.

I attached the diff for 5.4.1.

I hope this can be usefull.

Best regards.
João Paulo Ribeiro

-- 
João Paulo Ribeiro | Senior Software Engineer
jp@xxxxxxxxxxxx

PHONE: + 351 253 305 250
FAX  : + 351 253 305 250
www.mobicomp.com

________________________________________________________________

About Solutions | Wireless World

CONFIDENTIALITY NOTICE: This message, as well as existing attached files, is 
confidential and intended exclusively for the individual(s) named as 
addressees. If you are not the intended recipient, you are kindly requested 
not to make any use whatsoever of its contents and to proceed to the 
destruction of the message, thereby notifying the sender.
DISCLAIMER: The sender of this message can not ensure the security of its 
electronic transmission and consequently does not accept liability for any 
fact which may interfere with the integrity of its content.

32d31
< import javax.servlet.http.HttpUtils;
142c141
<             String line = new String(lineBuf,0,n,HttpUtils.ENCODING);
---
>           String line = new String(bytesToChars(lineBuf,0,n));


<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.