geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsis...@apache.org
Subject svn commit: r407425 - /geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
Date Thu, 18 May 2006 01:19:46 GMT
Author: jsisson
Date: Wed May 17 18:19:46 2006
New Revision: 407425

URL: http://svn.apache.org/viewvc?rev=407425&view=rev
Log:
GERONIMO-2034 [deployment] ensure output streams are closed in finally blocks

Modified:
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java

Modified: geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java?rev=407425&r1=407424&r2=407425&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
(original)
+++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
Wed May 17 18:19:46 2006
@@ -18,6 +18,7 @@
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.util.Collections;
 import java.util.jar.JarOutputStream;
 
@@ -80,13 +81,23 @@
         ArtifactManager artifactManager = new DefaultArtifactManager();
         ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager,
Collections.singleton(repository), null);
         DeploymentContext context = builder.buildConfiguration(false, builder.getConfigurationID(config,
null, new ModuleIDBuilder()), config, null, Collections.singleton(targetConfigurationStore),
artifactResolver, targetConfigurationStore);
-        ConfigurationData configurationData = context.getConfigurationData();
-
-        JarOutputStream out = new JarOutputStream(new FileOutputStream(carFile));
-        ExecutableConfigurationUtil.writeConfiguration(configurationData, out);
-        out.flush();
-        out.close();
-
-        context.close();
+        JarOutputStream out = null;
+        try {
+            ConfigurationData configurationData = context.getConfigurationData();
+            out = new JarOutputStream(new FileOutputStream(carFile));
+            ExecutableConfigurationUtil.writeConfiguration(configurationData, out);
+            out.flush();
+        } finally {
+            if (out != null)
+            {
+                try {
+                    out.close();
+                } catch (IOException ignored) {
+                    // ignored
+                }
+            }
+            if (context != null)
+                context.close();
+        }
     }
 }



Mime
View raw message