Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 1304 invoked from network); 4 Jun 2006 00:26:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Jun 2006 00:26:03 -0000 Received: (qmail 7938 invoked by uid 500); 4 Jun 2006 00:26:01 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 7894 invoked by uid 500); 4 Jun 2006 00:26:01 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 7883 invoked by uid 99); 4 Jun 2006 00:26:01 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jun 2006 17:26:01 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jun 2006 17:26:00 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 426C21A983A; Sat, 3 Jun 2006 17:25:40 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r411489 - /geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Date: Sun, 04 Jun 2006 00:25:39 -0000 To: scm@geronimo.apache.org From: kevan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060604002540.426C21A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: kevan Date: Sat Jun 3 17:25:39 2006 New Revision: 411489 URL: http://svn.apache.org/viewvc?rev=411489&view=rev Log: GERONIMO-2078 Make sure the configuration directories are cleaned up if a deployment fails. During an ear deploy, appclient configurations were not being cleaned up, if the deploy failed after the appclient configs had been created. The configurations are now deleted during cleanup processing Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=411489&r1=411488&r2=411489&view=diff ============================================================================== --- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original) +++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Sat Jun 3 17:25:39 2006 @@ -21,17 +21,19 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URL; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.LinkedList; +import java.util.List; import java.util.Map; import java.util.Set; -import java.util.LinkedHashMap; import java.util.jar.JarFile; import java.util.zip.ZipEntry; import javax.xml.namespace.QName; @@ -562,35 +564,19 @@ // it's the caller's responsibility to close the context... return earContext; } catch (GBeanAlreadyExistsException e) { - // todo delete owned configuraitons like appclients - if (earContext != null) { - earContext.close(); - } - cleanupConfigurationDir(configurationDir); + cleanupContext(earContext, configurationDir); throw new DeploymentException(e); } catch (IOException e) { - if (earContext != null) { - earContext.close(); - } - cleanupConfigurationDir(configurationDir); + cleanupContext(earContext, configurationDir); throw e; } catch (DeploymentException e) { - if (earContext != null) { - earContext.close(); - } - cleanupConfigurationDir(configurationDir); + cleanupContext(earContext, configurationDir); throw e; } catch(RuntimeException e) { - if (earContext != null) { - earContext.close(); - } - cleanupConfigurationDir(configurationDir); + cleanupContext(earContext, configurationDir); throw e; } catch(Error e) { - if (earContext != null) { - earContext.close(); - } - cleanupConfigurationDir(configurationDir); + cleanupContext(earContext, configurationDir); throw e; } finally { Set modules = applicationInfo.getModules(); @@ -598,6 +584,29 @@ Module module = (Module) iterator.next(); module.close(); } + } + } + + private void cleanupContext(EARContext earContext, File configurationDir) { + List configurations = new ArrayList(); + if (earContext != null) { + configurations.addAll(earContext.getAdditionalDeployment()); + try { + earContext.close(); + } catch (IOException ioe) { + // ignore any cleanup problems + } catch (DeploymentException de) { + // ignore any cleanup problems + } + } + // configurationDir is created before we create an EARContext + if (configurationDir != null) { + cleanupConfigurationDir(configurationDir); + } + // cleanup any other configurations generated (e.g. AppClient config dirs) + for (Iterator iterator = configurations.iterator(); iterator.hasNext();) { + ConfigurationData configurationData = (ConfigurationData) iterator.next(); + cleanupConfigurationDir(configurationData.getConfigurationDir()); } }