tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1486939 - in /tomcat/trunk/java/org/apache/catalina: connector/Request.java core/ApplicationPart.java
Date Tue, 28 May 2013 14:37:51 GMT
Author: markt
Date: Tue May 28 14:37:50 2013
New Revision: 1486939

URL: http://svn.apache.org/r1486939
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54971
Pass the calculated location to AplicationPart rather than it having to recalculate it every
time. Now correctly handles relative locations.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Request.java
    tomcat/trunk/java/org/apache/catalina/core/ApplicationPart.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1486939&r1=1486938&r2=1486939&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Tue May 28 14:37:50 2013
@@ -2621,7 +2621,7 @@ public class Request
                     }
                 }
                 for (FileItem item : items) {
-                    ApplicationPart part = new ApplicationPart(item, mce);
+                    ApplicationPart part = new ApplicationPart(item, location);
                     parts.add(part);
                     if (part.getSubmittedFileName() == null) {
                         String name = part.getName();

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationPart.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationPart.java?rev=1486939&r1=1486938&r2=1486939&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationPart.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationPart.java Tue May 28 14:37:50 2013
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.catalina.core;
 
 import java.io.File;
@@ -28,7 +27,6 @@ import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 
-import javax.servlet.MultipartConfigElement;
 import javax.servlet.http.Part;
 
 import org.apache.tomcat.util.http.fileupload.FileItem;
@@ -43,11 +41,11 @@ import org.apache.tomcat.util.http.fileu
 public class ApplicationPart implements Part {
 
     private final FileItem fileItem;
-    private final MultipartConfigElement mce;
+    private final File location;
 
-    public ApplicationPart(FileItem fileItem, MultipartConfigElement mce) {
+    public ApplicationPart(FileItem fileItem, File location) {
         this.fileItem = fileItem;
-        this.mce = mce;
+        this.location = location;
     }
 
     @Override
@@ -115,7 +113,7 @@ public class ApplicationPart implements 
     public void write(String fileName) throws IOException {
         File file = new File(fileName);
         if (!file.isAbsolute()) {
-            file = new File(mce.getLocation(), fileName);
+            file = new File(location, fileName);
         }
         try {
             fileItem.write(file);



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


Mime
View raw message