geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsis...@apache.org
Subject svn commit: r427123 - /geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
Date Mon, 31 Jul 2006 14:16:47 GMT
Author: jsisson
Date: Mon Jul 31 07:16:46 2006
New Revision: 427123

URL: http://svn.apache.org/viewvc?rev=427123&view=rev
Log:
GERONIMO-1996 (merged from 1.1 branch) Fix cleanup of configurations when Errors occur.  Previously
an Error such as a  java.lang.ExceptionInInitializerError during Serialization during deployment
leaves files in the repository and possibly leaves things in a state where you cannot undeploy.

Modified:
    geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java?rev=427123&r1=427122&r2=427123&view=diff
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
Mon Jul 31 07:16:46 2006
@@ -301,6 +301,7 @@
             // It's our responsibility to close this context, once we're done with it...
             DeploymentContext context = builder.buildConfiguration(inPlace, configID, plan,
module, stores, artifactResolver, store);
             List configurations = new ArrayList();
+            boolean configsCleanupRequired = false;
             configurations.add(context.getConfigurationData());
             configurations.addAll(context.getAdditionalDeployment());
 
@@ -334,23 +335,31 @@
                     notifyWatchers(deployedURIs);
                     return deployedURIs;
                 } else {
-                    cleanupConfigurations(configurations);
+                    configsCleanupRequired = true;
                     return Collections.EMPTY_LIST;
                 }
             } catch (DeploymentException e) {
-                cleanupConfigurations(configurations);
+                configsCleanupRequired = true;
                 throw e;
             } catch (IOException e) {
-                cleanupConfigurations(configurations);
+                configsCleanupRequired = true;
                 throw e;
             } catch (InvalidConfigException e) {
-                cleanupConfigurations(configurations);
+                configsCleanupRequired = true;
                 // unlikely as we just built this
                 throw new DeploymentException(e);
+            } catch (Throwable e) {
+                // Could get here if serialization of the configuration failed (GERONIMO-1996)
+                configsCleanupRequired = true;
+                throw e;
             } finally {
                 thread.setContextClassLoader(oldCl);
                 if (context != null) {
                     context.close();
+                }
+                if (configsCleanupRequired) {
+                    // We do this after context is closed so the module jar isn't open
+                    cleanupConfigurations(configurations);
                 }
             }
         } catch (Throwable e) {



Mime
View raw message