You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2009/09/05 05:54:03 UTC
svn commit: r811586 -
/incubator/click/trunk/click/framework/src/org/apache/click/service/CommonsFileUploadService.java
Author: sabob
Date: Sat Sep 5 03:54:02 2009
New Revision: 811586
URL: http://svn.apache.org/viewvc?rev=811586&view=rev
Log:
FileUploadService should print informative message if java.io.tmpdir does not exist: CLK-576
Modified:
incubator/click/trunk/click/framework/src/org/apache/click/service/CommonsFileUploadService.java
Modified: incubator/click/trunk/click/framework/src/org/apache/click/service/CommonsFileUploadService.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/service/CommonsFileUploadService.java?rev=811586&r1=811585&r2=811586&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/service/CommonsFileUploadService.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/service/CommonsFileUploadService.java Sat Sep 5 03:54:02 2009
@@ -18,11 +18,13 @@
*/
package org.apache.click.service;
+import java.io.File;
import java.util.List;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
+import org.apache.click.util.ClickUtils;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUploadBase;
import org.apache.commons.fileupload.FileUploadException;
@@ -72,11 +74,23 @@
/**
* @see FileUploadService#onInit(ServletContext)
-
* @param servletContext the application servlet context
* @throws Exception if an error occurs initializing the FileUploadService
*/
public void onInit(ServletContext servletContext) throws Exception {
+ ConfigService configService = ClickUtils.getConfigService(servletContext);
+ LogService logService = configService.getLogService();
+
+ // Uploaded files are saved to java.io.tmpdir. Here we check if this
+ // directory exists, if it does does not, log a warning
+ String tmpdir = System.getProperty("java.io.tmpdir");
+ File tmpfile = new File(tmpdir);
+ if (!tmpfile.exists()) {
+ logService.warn("The java.io.tmpdir directory, '" + tmpdir
+ + "', does not exist. This can cause file uploading to fail"
+ + " as uploaded files are saved to directory specified by the"
+ + " 'java.io.tmpdir' property.");
+ }
}
/**