cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Howard <cocoonge...@yahoo.com>
Subject Re: Bug in MultipartParser?
Date Mon, 23 Sep 2002 19:27:28 GMT
I had just started to look for a solution when I saw
your (Vadim's) patch (inline below).  It looks like no
one has tried the patch yet (at least on list), so I
did.  It's failing to compile because fileName is
declared multiple times.  In the patched version, it's
on lines 236 and 243.  Simply removing the String
declaration from line 243 so that it reads: 
      fileName = new File(fileName).getName();
seems to correct the problem - it compiles and works
(after removing the cocoon work directory).

The disclaimer - I only tested this with the following
setup:

Cocoon: HEAD
running on: Tomcat 4.0.4 running on linux
JDK: 1.4
Browser running from: Win2k (IE 5.5), Redhat linux
(links - commandline only)

Having said that, I don't see anything in the nature
of the patch that should arouse a lot of suspicion on
other configurations.

Thanks for your work,
Geoff Howard

Original Patch:

Index: MultipartParser.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon2/src/java/org/apache/cocoon/components/request/multipart/MultipartParser.java,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 MultipartParser.java
--- MultipartParser.java	23 May 2002 12:01:46 -0000
1.1.2.2
+++ MultipartParser.java	20 Sep 2002 12:28:35 -0000
@@ -233,11 +233,14 @@
         if (!saveUploadedFilesToDisk) {
             out = new ByteArrayOutputStream();
         } else {
-            String filePath =
uploadDirectory.getPath() + File.separator;
-	
-            String fileName =
-                    new File((String)
headers.get("filename")).getName();
+            String fileName = (String)
headers.get("filename");
+            if(File.separatorChar == '\\')
+                fileName =
fileName.replace('/','\\');
+            else
+                fileName =
fileName.replace('\\','/');
 
+            String filePath =
uploadDirectory.getPath() + File.separator;
+            String fileName = new
File(fileName).getName();
             file = new File(filePath + fileName);
 
             if (file.exists()) {


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message