You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/03/19 17:28:16 UTC

svn commit: r638923 - /servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java

Author: gnodet
Date: Wed Mar 19 09:28:11 2008
New Revision: 638923

URL: http://svn.apache.org/viewvc?rev=638923&view=rev
Log:
SMX4KNL-6: Error Message improvement on Gshell console when a command is not found

Modified:
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java?rev=638923&r1=638922&r2=638923&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java Wed Mar 19 09:28:11 2008
@@ -26,6 +26,7 @@
 import org.apache.geronimo.gshell.command.IO;
 import org.apache.geronimo.gshell.common.Arguments;
 import org.apache.geronimo.gshell.console.Console;
+import org.apache.geronimo.gshell.layout.NotFoundException;
 import org.apache.geronimo.gshell.shell.Environment;
 import org.apache.geronimo.gshell.shell.InteractiveShell;
 import org.apache.servicemix.kernel.main.spi.MainService;
@@ -35,7 +36,6 @@
 import org.osgi.framework.FrameworkListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
 import org.springframework.osgi.context.BundleContextAware;
 
 /**
@@ -187,8 +187,13 @@
             public Result handleError(Throwable error) {
                 if (closed) {
                     throw new ExitNotification();
+                } else if (error instanceof NotFoundException) {
+                    // Spit out the terse reason why we've failed
+                    io.err.println("@|bold,red ERROR| Command not found: @|bold,red " + error.getMessage() + "|");
+                    return Result.CONTINUE;
+                } else {
+                    return handler.handleError(error);
                 }
-                return handler.handleError(error);
             }
         };
     }