You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/05/28 16:48:58 UTC

svn commit: r1486942 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/connector/Request.java java/org/apache/catalina/core/ApplicationPart.java webapps/docs/changelog.xml

Author: markt
Date: Tue May 28 14:48:58 2013
New Revision: 1486942

URL: http://svn.apache.org/r1486942
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/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationPart.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1486939

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java?rev=1486942&r1=1486941&r2=1486942&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Request.java Tue May 28 14:48:58 2013
@@ -2733,7 +2733,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/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationPart.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationPart.java?rev=1486942&r1=1486941&r2=1486942&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationPart.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationPart.java Tue May 28 14:48:58 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;
@@ -42,12 +40,12 @@ import org.apache.tomcat.util.http.fileu
  */
 public class ApplicationPart implements Part {
 
-    private FileItem fileItem;
-    private MultipartConfigElement mce;
+    private final FileItem fileItem;
+    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);

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1486942&r1=1486941&r2=1486942&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue May 28 14:48:58 2013
@@ -84,6 +84,10 @@
         response. (violetagg)
       </fix>
       <fix>
+        <bug>54971</bug>: Ensure that the correct location is used when writing
+        files via <code>avax.servlet.http.Part.write(String)</code>. (markt)
+      </fix>
+      <fix>
         <bug>54974</bug>: Ensure that 
         <code>SessionCookieConfig#set&lt;methods&gt;</code>
         will throw <code>IllegalStateException</code> if the



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