Hurray! Thanks, Aaron
On 7/31/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: jsisson Date: Mon Jul 31 07:08:13 2006 New Revision: 427120 URL: http://svn.apache.org/viewvc?rev=427120&view=rev Log: GERONIMO-1996 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/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java?rev=427120&r1=427119&r2=427120&view=diff ============================================================================== --- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java (original) +++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java Mon Jul 31 07:08:13 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) {