geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r705615 - in /geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell: CommandLineBuilderImpl.java CommandLineExecutorImpl.java ShellImpl.java
Date Fri, 17 Oct 2008 13:34:37 GMT
Author: jdillon
Date: Fri Oct 17 06:34:35 2008
New Revision: 705615

URL: http://svn.apache.org/viewvc?rev=705615&view=rev
Log:
Use Closer instead of plexus-utils IOUtil
Inline use of plexus-utils StringUtils instead of using the dependency

Modified:
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java?rev=705615&r1=705614&r2=705615&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
Fri Oct 17 06:34:35 2008
@@ -29,7 +29,7 @@
 import org.apache.geronimo.gshell.parser.visitor.ExecutingVisitor;
 import org.apache.geronimo.gshell.parser.visitor.LoggingVisitor;
 import org.apache.geronimo.gshell.shell.ShellContext;
-import org.codehaus.plexus.util.IOUtil;
+import org.apache.geronimo.gshell.io.Closer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -61,7 +61,7 @@
             cl = parser.parse(reader);
         }
         finally {
-            IOUtil.close(reader);
+            Closer.close(reader);
         }
 
         // If debug is enabled, the log the parse tree

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java?rev=705615&r1=705614&r2=705615&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
Fri Oct 17 06:34:35 2008
@@ -32,10 +32,10 @@
 import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.io.SystemOutputHijacker;
+import org.apache.geronimo.gshell.io.Closer;
 import org.apache.geronimo.gshell.notification.ErrorNotification;
 import org.apache.geronimo.gshell.notification.Notification;
 import org.apache.geronimo.gshell.shell.ShellContext;
-import org.codehaus.plexus.util.IOUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -171,10 +171,10 @@
                     }
                     finally {
                         if (idx > 0) {
-                            IOUtil.close(ios[idx].inputStream);
+                            Closer.close(ios[idx].inputStream);
                         }
                         if (idx < commands.length - 1) {
-                            IOUtil.close(ios[idx].outputStream);
+                            Closer.close(ios[idx].outputStream);
                         }
                     }
                 }
@@ -244,7 +244,7 @@
             throw result.getNotification();
         }
         else if (result.hasFailed()) {
-            //noinspection ThrowableResultOfMethodCallIgnored
+            // noinspection ThrowableResultOfMethodCallIgnored
             throw new CommandException(result.getFailure());
         }
         else {

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java?rev=705615&r1=705614&r2=705615&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
Fri Oct 17 06:34:35 2008
@@ -30,12 +30,11 @@
 import org.apache.geronimo.gshell.console.JLineConsole;
 import org.apache.geronimo.gshell.console.completer.AggregateCompleter;
 import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.io.Closer;
 import org.apache.geronimo.gshell.model.application.Branding;
 import org.apache.geronimo.gshell.notification.ExitNotification;
 import org.apache.geronimo.gshell.shell.Shell;
 import org.apache.geronimo.gshell.shell.ShellContext;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -247,7 +246,7 @@
             String message = branding.getWelcomeMessage();
             if (message != null) {
                 io.out.print(message);
-                io.out.println(StringUtils.repeat("-", io.getTerminal().getTerminalWidth()
- 1));
+                io.out.println(repeat("-", io.getTerminal().getTerminalWidth() - 1));
                 io.out.flush();
             }
         }
@@ -267,6 +266,14 @@
         }
     }
 
+    private static String repeat(String str, int repeat) {
+        StringBuffer buffer = new StringBuffer(repeat * str.length());
+        for (int i = 0; i < repeat; i++) {
+            buffer.append(str);
+        }
+        return buffer.toString();
+    }
+
     public Prompter getPrompter() {
         if (prompter == null) {
             throw new IllegalStateException("Missing configuration property: prompter");
@@ -316,7 +323,7 @@
             }
         }
         finally {
-            IOUtil.close(reader);
+            Closer.close(reader);
         }
     }
 



Mime
View raw message