You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2008/01/19 14:47:33 UTC

svn commit: r613391 - in /geronimo/server: branches/2.0/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/configmanager/

Author: vamsic007
Date: Sat Jan 19 05:47:33 2008
New Revision: 613391

URL: http://svn.apache.org/viewvc?rev=613391&view=rev
Log:
GERONIMO-3763 Deploy New portlet does not cleanup the temp files
 o Deletes temporary files.
 o Upon failure, calls deleteOnExit.

Modified:
    geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java

Modified: geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java?rev=613391&r1=613390&r2=613391&view=diff
==============================================================================
--- geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java (original)
+++ geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java Sat Jan 19 05:47:33 2008
@@ -43,6 +43,8 @@
 import org.apache.commons.fileupload.FileUploadException;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.fileupload.portlet.PortletFileUpload;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.BasePortlet;
 import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
 import org.apache.geronimo.deployment.plugin.ConfigIDExtractor;
@@ -52,7 +54,12 @@
 import org.apache.geronimo.upgrade.Upgrade1_0To1_1;
 import org.w3c.dom.Document;
 
+/**
+ * $Rev$ $Date$
+ */
 public class DeploymentPortlet extends BasePortlet {
+    private final static Log log = LogFactory.getLog(DeploymentPortlet.class);
+    
     private static final String DEPLOY_VIEW          = "/WEB-INF/view/configmanager/deploy.jsp";
     private static final String HELP_VIEW            = "/WEB-INF/view/configmanager/deployHelp.jsp";
     private static final String MIGRATED_PLAN_PARM   = "migratedPlan";
@@ -191,6 +198,18 @@
             } finally {
                 mgr.release();
                 if (fis!=null) fis.close();
+                if(moduleFile != null && moduleFile.exists()) {
+                    if(!moduleFile.delete()) {
+                        log.debug("Unable to delete temporary file "+moduleFile);
+                        moduleFile.deleteOnExit();
+                    }
+                }
+                if(planFile != null && planFile.exists()) {
+                    if(!planFile.delete()) {
+                        log.debug("Unable to delete temporary file "+planFile);
+                        planFile.deleteOnExit();
+                    }
+                }
             }
         } catch (Exception e) {
             throw new PortletException(e);

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java?rev=613391&r1=613390&r2=613391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java (original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java Sat Jan 19 05:47:33 2008
@@ -43,6 +43,8 @@
 import org.apache.commons.fileupload.FileUploadException;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.fileupload.portlet.PortletFileUpload;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.BasePortlet;
 import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager;
 import org.apache.geronimo.deployment.plugin.ConfigIDExtractor;
@@ -52,7 +54,12 @@
 import org.apache.geronimo.upgrade.Upgrade1_0To1_1;
 import org.w3c.dom.Document;
 
+/**
+ * $Rev$ $Date$
+ */
 public class DeploymentPortlet extends BasePortlet {
+    private final static Log log = LogFactory.getLog(DeploymentPortlet.class);
+    
     private static final String DEPLOY_VIEW          = "/WEB-INF/view/configmanager/deploy.jsp";
     private static final String HELP_VIEW            = "/WEB-INF/view/configmanager/deployHelp.jsp";
     private static final String MIGRATED_PLAN_PARM   = "migratedPlan";
@@ -195,6 +202,18 @@
             } finally {
                 mgr.release();
                 if (fis!=null) fis.close();
+                if(moduleFile != null && moduleFile.exists()) {
+                    if(!moduleFile.delete()) {
+                        log.debug("Unable to delete temporary file "+moduleFile);
+                        moduleFile.deleteOnExit();
+                    }
+                }
+                if(planFile != null && planFile.exists()) {
+                    if(!planFile.delete()) {
+                        log.debug("Unable to delete temporary file "+planFile);
+                        planFile.deleteOnExit();
+                    }
+                }
             }
         } catch (Exception e) {
             throw new PortletException(e);