geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r574520 - in /geronimo/sandbox/gshell/trunk: gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ gshell-core/src/main/java/org/apache/geronimo/gshell/ gshell-core/src/main/java/org/apache/geronimo/gsh...
Date Tue, 11 Sep 2007 09:12:32 GMT
Author: jdillon
Date: Tue Sep 11 02:12:30 2007
New Revision: 574520

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

Modified:
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/CommandLineBuilder.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/PropertiesVersionLoader.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/loader/XMLLayoutLoader.java

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java?rev=574520&r1=574519&r2=574520&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
Tue Sep 11 02:12:30 2007
@@ -32,6 +32,7 @@
 import org.apache.geronimo.gshell.command.CommandSupport;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
 import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.IOUtil;
 
 /**
  * Read and execute commands from a file/url in the current shell environment.
@@ -59,12 +60,16 @@
         }
         
         BufferedReader reader = openReader(url);
-
-        String line;
-        while ((line = reader.readLine()) != null) {
-            executor.execute(line);
+        try {
+            String line;
+            while ((line = reader.readLine()) != null) {
+                executor.execute(line);
+            }
         }
-
+        finally {
+            IOUtil.close(reader);
+        }
+        
         return SUCCESS;
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/CommandLineBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/CommandLineBuilder.java?rev=574520&r1=574519&r2=574520&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/CommandLineBuilder.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/CommandLineBuilder.java
Tue Sep 11 02:12:30 2007
@@ -27,10 +27,10 @@
 import org.apache.geronimo.gshell.parser.CommandLineParser;
 import org.apache.geronimo.gshell.parser.ParseException;
 import org.apache.geronimo.gshell.shell.Environment;
-import org.apache.geronimo.gshell.expression.ExpressionEvaluator;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.IOUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -53,7 +53,13 @@
         assert input != null;
 
         Reader reader = new StringReader(input);
-        ASTCommandLine cl = parser.parse(reader);
+        ASTCommandLine cl;
+        try {
+            cl = parser.parse(reader);
+        }
+        finally {
+            IOUtil.close(reader);
+        }
 
         // If debug is enabled, the log the parse tree
         if (log.isDebugEnabled()) {

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java?rev=574520&r1=574519&r2=574520&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
Tue Sep 11 02:12:30 2007
@@ -30,20 +30,18 @@
 import org.apache.geronimo.gshell.branding.Branding;
 import org.apache.geronimo.gshell.command.CommandExecutor;
 import org.apache.geronimo.gshell.command.IO;
-import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.console.Console;
 import org.apache.geronimo.gshell.console.JLineConsole;
 import org.apache.geronimo.gshell.console.TerminalInfo;
-import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
 import org.apache.geronimo.gshell.shell.Environment;
 import org.apache.geronimo.gshell.shell.InteractiveShell;
 import org.apache.geronimo.gshell.shell.Shell;
 import org.apache.geronimo.gshell.shell.ShellInfo;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.component.factory.ComponentFactory;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.util.IOUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -289,7 +287,7 @@
             }
         }
         finally {
-            reader.close();
+            IOUtil.close(reader);
         }
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/PropertiesVersionLoader.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/PropertiesVersionLoader.java?rev=574520&r1=574519&r2=574520&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/PropertiesVersionLoader.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/PropertiesVersionLoader.java
Tue Sep 11 02:12:30 2007
@@ -24,6 +24,7 @@
 import java.util.Properties;
 
 import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.IOUtil;
 
 /**
  * Loads a version number from a properties file.
@@ -47,10 +48,12 @@
             try {
                 props = new Properties();
                 props.load(input);
-                input.close();
             }
             catch (IOException e) {
                 throw new RuntimeException("Failed to load " + resourceName, e);
+            }
+            finally {
+                IOUtil.close(input);
             }
         }
         

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/loader/XMLLayoutLoader.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/loader/XMLLayoutLoader.java?rev=574520&r1=574519&r2=574520&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/loader/XMLLayoutLoader.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/loader/XMLLayoutLoader.java
Tue Sep 11 02:12:30 2007
@@ -31,6 +31,7 @@
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.util.IOUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -87,7 +88,7 @@
             layout = Layout.fromXML(input);
         }
         finally {
-           input.close();
+           IOUtil.close(input);
         }
 
         log.debug("Loaded layout: {}", layout);



Mime
View raw message