You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/05/17 12:02:48 UTC
DO NOT REPLY [Bug 9198] New: -
First line feed in text parameters lost
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9198>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9198
First line feed in text parameters lost
Summary: First line feed in text parameters lost
Product: Struts
Version: 1.1 Beta 1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: Other
Component: File Upload
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: alexander.lamm@livinglogic.de
After moving from Struts 1.0 to Struts 1.1 b1, I encountered the following
problem:
When I enter text into "textarea" fields in forms which use
enctype="multipart/form-data", because they are also used for file upload, the
first line feed I have entered gets lost.
At first I supposed a browser bug, but then I realized, that this phenomenon
doesn't appear for forms which don't use enctype="multipart/form-data". Since I
couldn't find anything about this problem in the mailing lists and existing bug
reports, I decided to go on searching the source code.
In org.apache.struts.upload.MultipartBoundaryInputStream#readElementHeaders() I
found that the line feed was dismissed by calling resetCrlf() in line 359. It
seems to me that this call is only needed in skipCurrentLineIfBlank(), if the
current line is blank. I applied the following patch and everything worked fine
for me:
Index: src/share/org/apache/struts/upload/MultipartBoundaryInputStream.java
===================================================================
RCS file: /home/cvspublic/jakarta-
struts/src/share/org/apache/struts/upload/MultipartBoundaryInputStream.java,v
retrieving revision 1.1
diff -u -r1.1 MultipartBoundaryInputStream.java
--- src/share/org/apache/struts/upload/MultipartBoundaryInputStream.java
6 Mar 2002 19:44:07 -0000 1.1
+++ src/share/org/apache/struts/upload/MultipartBoundaryInputStream.java
17 May 2002 09:54:58 -0000
@@ -356,7 +356,6 @@
readContentDisposition();
resetCrlf();
boolean hadContentType = readContentType();
- resetCrlf();
if (hadContentType)
{
skipCurrentLineIfBlank();
@@ -514,7 +513,11 @@
private final void skipCurrentLineIfBlank() throws IOException
{
boolean fill = false;
- if (this.lineLength == 1)
+ if (this.lineLength == 0)
+ {
+ fill = true;
+ }
+ else if (this.lineLength == 1)
{
if (this.line[0] == NEWLINE_BYTE)
{
@@ -530,6 +533,7 @@
}
if (fill && !this.endOfStream)
{
+ resetCrlf();
fillLine();
}
}
I don't know enough about RFC1867 however, to be sure, the behaviour I produced
is the desired one for this class.
I hope the proposed patch is useful somehow. Thanks for considering my problem.
Alex.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>