jericho 2002/11/23 19:14:41
Modified: fileupload/src/java/org/apache/commons/fileupload
MultipartStream.java
Log:
- Fix the multi-bytes support .
Whenever StringBuffer and String class are used and the MULTI-BYTEs support
should be considered, it should be treated with raw character rather than byte.
Reported and patched by Park Jong-Jin (ecogeo at dreamwiz.com)
Revision Changes Path
1.8 +7 -7
jakarta-commons/fileupload/src/java/org/apache/commons/fileupload/MultipartStream.java
Index: MultipartStream.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/fileupload/src/java/org/apache/commons/fileupload/MultipartStream.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MultipartStream.java 22 Aug 2002 04:26:47 -0000 1.7
+++ MultipartStream.java 24 Nov 2002 03:14:41 -0000 1.8
@@ -413,8 +413,8 @@
{
int i = 0;
byte b[] = new byte[1];
- StringBuffer buf = new StringBuffer();
int sizeMax = HEADER_PART_SIZE_MAX;
+ byte[] buf = new byte[sizeMax];
int size = 0;
while (i < 4)
{
@@ -437,10 +437,10 @@
}
if (size <= sizeMax)
{
- buf.append(new String(b));
+ buf[size] = b[0];
}
}
- return buf.toString();
+ return new String(buf, 0, tail);
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>