diff --git a/dspace-api/src/main/java/org/dspace/core/ConfigurationManager.java b/dspace-api/src/main/java/org/dspace/core/ConfigurationManager.java index 493b926950..84fb8b8240 100644 --- a/dspace-api/src/main/java/org/dspace/core/ConfigurationManager.java +++ b/dspace-api/src/main/java/org/dspace/core/ConfigurationManager.java @@ -507,7 +507,17 @@ public class ConfigurationManager try { - String configProperty = System.getProperty("dspace.configuration"); + String configProperty = null; + try + { + configProperty = System.getProperty("dspace.configuration"); + } + catch (SecurityException se) + { + // A security manager may stop us from accessing the system properties. + // This isn't really a fatal error though, so catch and ignore + log.warn("Unable to access system properties, ignoring.", se); + } if (configFile != null) { diff --git a/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/util/FileUploadRequest.java b/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/util/FileUploadRequest.java index 74db970c5d..1aa6838f66 100755 --- a/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/util/FileUploadRequest.java +++ b/dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/util/FileUploadRequest.java @@ -55,6 +55,8 @@ import javax.servlet.http.HttpServletRequestWrapper; import org.apache.commons.fileupload.DiskFileUpload; import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.servlet.ServletFileUpload; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.dspace.core.ConfigurationManager; /** @@ -98,11 +100,15 @@ public class FileUploadRequest extends HttpServletRequestWrapper tempDir = ConfigurationManager.getProperty("upload.temp.dir"); int maxSize = ConfigurationManager.getIntProperty("upload.max"); - DiskFileUpload upload = new DiskFileUpload(); + // Create a factory for disk-based file items + DiskFileItemFactory factory = new DiskFileItemFactory(); + factory.setRepository(new File(tempDir)); + // Create a new file upload handler + ServletFileUpload upload = new ServletFileUpload(factory); + try { - upload.setRepositoryPath(tempDir); upload.setSizeMax(maxSize); items = upload.parseRequest(req); for (Iterator i = items.iterator(); i.hasNext();) diff --git a/dspace-jspui/dspace-jspui-webapp/src/main/webapp/WEB-INF/web.xml b/dspace-jspui/dspace-jspui-webapp/src/main/webapp/WEB-INF/web.xml index 924b74af52..a1dff39e94 100644 --- a/dspace-jspui/dspace-jspui-webapp/src/main/webapp/WEB-INF/web.xml +++ b/dspace-jspui/dspace-jspui-webapp/src/main/webapp/WEB-INF/web.xml @@ -124,6 +124,10 @@ /view-workspaceitem + + + org.apache.commons.fileupload.servlet.FileCleanerCleanup + org.dspace.app.util.DSpaceContextListener diff --git a/dspace-lni/dspace-lni-webapp/src/main/webapp/WEB-INF/web.xml b/dspace-lni/dspace-lni-webapp/src/main/webapp/WEB-INF/web.xml index 23bccf81a9..fcb304339f 100644 --- a/dspace-lni/dspace-lni-webapp/src/main/webapp/WEB-INF/web.xml +++ b/dspace-lni/dspace-lni-webapp/src/main/webapp/WEB-INF/web.xml @@ -50,7 +50,12 @@ The location of the main DSpace configuration file - + + + + org.dspace.app.util.DSpaceContextListener + + diff --git a/dspace-oai/dspace-oai-webapp/src/main/webapp/WEB-INF/web.xml b/dspace-oai/dspace-oai-webapp/src/main/webapp/WEB-INF/web.xml index 75d4708b67..a1a7f28029 100644 --- a/dspace-oai/dspace-oai-webapp/src/main/webapp/WEB-INF/web.xml +++ b/dspace-oai/dspace-oai-webapp/src/main/webapp/WEB-INF/web.xml @@ -70,6 +70,11 @@ + + + org.dspace.app.util.DSpaceContextListener + + diff --git a/dspace-sword/dspace-sword-webapp/src/main/webapp/WEB-INF/web.xml b/dspace-sword/dspace-sword-webapp/src/main/webapp/WEB-INF/web.xml index 0f2efab4a7..dc80f5aca8 100644 --- a/dspace-sword/dspace-sword-webapp/src/main/webapp/WEB-INF/web.xml +++ b/dspace-sword/dspace-sword-webapp/src/main/webapp/WEB-INF/web.xml @@ -39,6 +39,11 @@ + + + org.dspace.app.util.DSpaceContextListener + + diff --git a/dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/WEB-INF/web.xml b/dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/WEB-INF/web.xml index db83bea317..c8d39344dc 100644 --- a/dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/WEB-INF/web.xml +++ b/dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/WEB-INF/web.xml @@ -49,6 +49,10 @@ + + + org.apache.commons.fileupload.servlet.FileCleanerCleanup + org.dspace.app.util.DSpaceContextListener diff --git a/pom.xml b/pom.xml index 40187d256e..a17dc3e4f6 100644 --- a/pom.xml +++ b/pom.xml @@ -325,12 +325,12 @@ commons-fileupload commons-fileupload - 1.1.1 + 1.2.1 commons-io commons-io - 1.2 + 1.4 commons-lang