Ugh, I found the same bug in the multipart parse we were using in my
last job. The problem was that readLine() removed the end-of-line
characters and they were added back somewhere else, if I recall
correctly. If it got a full 4092 characters in one read, there was no
way to know if it had read a partial line 4092 characters long or a full
line of 4092 character plus newline. Where the newline was added back
on, there was no check implemented or possible to deal with this
boundary condition.
I can't remember how I fixed it (this was four or five years back) but
it seems like the simplest solution would be not to stip the newline in
readLine(). That change may break assumptions and invariants that need
to hold elsewhere, though...
L.
meyawn wrote:
i found out what the problem was..the problem that happens is that if a file
has a line more than 4096 then you can see a character missing and instead
of it you will find a newline char..happens with every file, not only
PDF....maybe this problem is not in later version of struts but sure is in
1.0 final release...the problem is with
upload.MultipartIterator.createLocalFile() and also in
BufferedMultipartInputStream.readLine()...wont bore you with details, but a
cheap fix would be to do MultipartIterator.MAX_READ_SIZE to something more
than 4092.
-----Original Message-----
From: Adam Hardy [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 21, 2005 7:15 PM
To: Struts Users Mailing List
Subject: Re: file upload struts - pdf corrupted
On 20/05/05 10:33 Nandan wrote:
Hello,
I am using struts 1.0.2 to upload files. However sometimes a PDF file gets
corrupted after a file upload. I see that random characters are replaced a
hex 0A. Is this is a known bug? Please let me know
GP
Try checking bugzilla for commons-fileupload, or ask on the
jakarta-commons user list.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]