svn commit: r1062361 - in /struts/struts2/trunk/core/src/main/java/org/apache/struts2: dispatcher/multipart/JakartaMultiPartRequest.java interceptor/FileUploadInterceptor.java

2011-01-23 Thread mcucchiara
Author: mcucchiara
Date: Sun Jan 23 10:17:42 2011
New Revision: 1062361

URL: http://svn.apache.org/viewvc?rev=1062361&view=rev
Log:
WW-3562 - FileUploadInterceptor: File not uploaded when file is empty (0 bytes)

Modified:

struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java

struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java?rev=1062361&r1=1062360&r2=1062361&view=diff
==
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
 Sun Jan 23 10:17:42 2011
@@ -192,7 +192,17 @@ public class JakartaMultiPartRequest imp
 
 List fileList = new ArrayList(items.size());
 for (FileItem fileItem : items) {
-fileList.add(((DiskFileItem) fileItem).getStoreLocation());
+File storeLocation = ((DiskFileItem) fileItem).getStoreLocation();
+if(fileItem.isInMemory() && storeLocation!=null && 
!storeLocation.exists()) {
+try {
+storeLocation.createNewFile();
+} catch (IOException e) {
+if(LOG.isErrorEnabled()){
+LOG.error("Cannot write uploaded empty file to disk: " 
+ storeLocation.getAbsolutePath(),e);
+}
+}
+}
+fileList.add(storeLocation);
 }
 
 return fileList.toArray(new File[fileList.size()]);

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java?rev=1062361&r1=1062360&r2=1062361&view=diff
==
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
 Sun Jan 23 10:17:42 2011
@@ -325,7 +325,7 @@ public class FileUploadInterceptor exten
 }
 
 if ((currentFile != null) && currentFile.isFile()) {
-if (currentFile.delete() == false) {
+if (!currentFile.delete()) {
 LOG.warn("Resource Leaking:  Could not remove uploaded 
file '" + currentFile.getCanonicalPath() + "'.");
 }
 }




[CONF] Confluence Changes in the last 24 hours

2011-01-23 Thread confluence
This is a daily summary of all recent changes in Confluence.

-
Updated Spaces:
-


Apache ActiveMQ (https://cwiki.apache.org/confluence/display/ACTIVEMQ)

Pages
-
XMPP edited by  gliesian  (09:53 AM)
https://cwiki.apache.org/confluence/display/ACTIVEMQ/XMPP



Apache Axis (https://cwiki.apache.org/confluence/display/AXIS)

Pages
-
Report March 2011 edited by  veithen  (08:32 AM)
https://cwiki.apache.org/confluence/display/AXIS/Report+March+2011



Apache Camel (https://cwiki.apache.org/confluence/display/CAMEL)

Pages
-
Camel 2.6.0 Release edited by  davsclaus  (08:50 AM)
https://cwiki.apache.org/confluence/display/CAMEL/Camel+2.6.0+Release

Splitter edited by  muellerc  (06:56 AM)
https://cwiki.apache.org/confluence/display/CAMEL/Splitter



Apache Geronimo v3.0 (https://cwiki.apache.org/confluence/display/GMOxDOC30)

Pages
-
Deploying and undeploying applications edited by  maojia508  (10:47 PM)
https://cwiki.apache.org/confluence/display/GMOxDOC30/Deploying+and+undeploying+applications

Introducing Geronimo Administration Console edited by  maojia508  (10:38 PM)
https://cwiki.apache.org/confluence/display/GMOxDOC30/Introducing+Geronimo+Administration+Console



Apache Tapestry (https://cwiki.apache.org/confluence/display/TAPESTRY)

Pages
-
Index edited by  karesti  (09:32 AM)
https://cwiki.apache.org/confluence/display/TAPESTRY/Index



Apache Wicket (https://cwiki.apache.org/confluence/display/WICKET)

Pages
-
Migration to Wicket 1.5 edited by  martin-g  (05:37 AM)
https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+1.5




Change your notification preferences: 
https://cwiki.apache.org/confluence/users/viewnotifications.action