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/12/24 02:03:28 UTC
svn commit: r893670 -
/incubator/click/trunk/click/framework/src/org/apache/click/service/CommonsFileUploadService.java
Author: sabob
Date: Thu Dec 24 01:03:28 2009
New Revision: 893670
URL: http://svn.apache.org/viewvc?rev=893670&view=rev
Log:
log warning when deploying CommonsFileUploadService on Google App Engine
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=893670&r1=893669&r2=893670&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 Thu Dec 24 01:03:28 2009
@@ -19,6 +19,7 @@
package org.apache.click.service;
import java.io.File;
+import java.security.AccessControlException;
import java.util.List;
import javax.servlet.ServletContext;
@@ -81,15 +82,31 @@
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.");
+ try {
+ // 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.");
+ }
+
+ } catch (AccessControlException exception) {
+ if (!ClickUtils.isResourcesDeployable(servletContext)) {
+ // Probably deploying on Google App Engine which throws
+ // Security Exception if accessing temp folder
+ logService.warn("If you are deploying to Google App Engine,"
+ + " please note that Click's default"
+ + " org.apache.click.service.CommonsFileUploadService"
+ + " does not work with Google App Engine. Instead use"
+ + " org.apache.click.extras.gae.MemoryFileUploadService.");
+ } else {
+ // If resources are deployable throw exception
+ throw exception;
+ }
}
}