geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r574523 - in /geronimo/sandbox/gshell/trunk: gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/ gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/ gshell-maven-plugin/src...
Date Tue, 11 Sep 2007 09:18:07 GMT
Author: jdillon
Date: Tue Sep 11 02:18:06 2007
New Revision: 574523

URL: http://svn.apache.org/viewvc?rev=574523&view=rev
Log:
More use of IOUtil to close

Modified:
    geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/CommandSetDescriptorWriter.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/CatCommand.java
    geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java
    geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java
    geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/StreamPumper.java

Modified: geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/CommandSetDescriptorWriter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/CommandSetDescriptorWriter.java?rev=574523&r1=574522&r2=574523&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/CommandSetDescriptorWriter.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-command-api/src/main/java/org/apache/geronimo/gshell/command/descriptor/CommandSetDescriptorWriter.java
Tue Sep 11 02:18:06 2007
@@ -51,8 +51,6 @@
             w.endElement();
 
             writer.write(LS);
-
-            writer.close();
         }
         catch (PlexusConfigurationException e) {
             throw new Exception("Internal error while writing out the configuration", e);

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/CatCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/CatCommand.java?rev=574523&r1=574522&r2=574523&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/CatCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/CatCommand.java
Tue Sep 11 02:18:06 2007
@@ -34,6 +34,7 @@
 import org.apache.geronimo.gshell.command.IO;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
 import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.IOUtil;
 
 /**
  * Concatenate and print files and/or URLs.
@@ -76,9 +77,12 @@
                     reader = new BufferedReader(new FileReader(file));
                 }
 
-                cat(reader, io);
-
-                reader.close();
+                try {
+                    cat(reader, io);
+                }
+                finally {
+                    IOUtil.close(reader);
+                }
             }
         }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java?rev=574523&r1=574522&r2=574523&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java
Tue Sep 11 02:18:06 2007
@@ -43,6 +43,7 @@
 import org.codehaus.plexus.component.repository.ComponentRequirement;
 import org.codehaus.plexus.configuration.PlexusConfiguration;
 import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.IOUtil;
 
 /**
  * Generates a GShell XML commands descriptor.
@@ -248,17 +249,20 @@
 
             // Write the file
 
+            BufferedWriter output = null;
             try {
-                BufferedWriter output = new BufferedWriter(new FileWriter(outputFile));
+                output = new BufferedWriter(new FileWriter(outputFile));
                 CommandSetDescriptorWriter writer = new CommandSetDescriptorWriter();
 
                 writer.write(output, setDesc);
-                output.close();
 
                 getLog().debug("Wrote " + outputFile);
             }
             catch (Exception e) {
                 throw new MojoExecutionException("Failed to write commands descriptor", e);
+            }
+            finally {
+                IOUtil.close(output);
             }
         }
     }

Modified: geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java?rev=574523&r1=574522&r2=574523&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java
Tue Sep 11 02:18:06 2007
@@ -23,6 +23,8 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.codehaus.plexus.util.IOUtil;
+
 //
 // Based on Apache Ant 1.6.5
 //
@@ -98,12 +100,7 @@
             inputPump = createInputPump(in, out, true);
         }
         else {
-            try {
-                out.close();
-            }
-            catch (IOException e) {
-                // ignore
-            }
+            IOUtil.close(out);
         }
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/StreamPumper.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/StreamPumper.java?rev=574523&r1=574522&r2=574523&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/StreamPumper.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/StreamPumper.java
Tue Sep 11 02:18:06 2007
@@ -19,10 +19,11 @@
 
 package org.apache.geronimo.gshell.common.io;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.codehaus.plexus.util.IOUtil;
+
 //
 // Based on Apache Ant 1.6.5
 //
@@ -120,12 +121,7 @@
         }
         finally {
             if (closeWhenExhausted) {
-                try {
-                    out.close();
-                }
-                catch (IOException e) {
-                    // ignore
-                }
+                IOUtil.close(out);
             }
             finished = true;
 



Mime
View raw message