You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/06/01 10:35:27 UTC

svn commit: r662171 - /geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java

Author: jdillon
Date: Sun Jun  1 01:35:27 2008
New Revision: 662171

URL: http://svn.apache.org/viewvc?rev=662171&view=rev
Log:
Don't hind exception details

Modified:
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java?rev=662171&r1=662170&r2=662171&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java Sun Jun  1 01:35:27 2008
@@ -26,6 +26,7 @@
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.common.Arguments;
 import org.apache.geronimo.gshell.common.StopWatch;
+import org.apache.geronimo.gshell.common.Notification;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.layout.LayoutManager;
 import org.apache.geronimo.gshell.layout.NotFoundException;
@@ -204,19 +205,13 @@
         if (!errors.isEmpty()) {
             Throwable t = errors.get(0);
 
-            //
-            // FIXME: Should not throw here, as that will cause the originating stack trace to be lost
-            //
-
-            if (t instanceof Exception) {
-                throw (Exception) t;
-            }
-            else if (t instanceof Error) {
-                throw (Error) t;
-            }
-            else {
-                throw new RuntimeException(t);
+            // Always preserve the type of notication throwables, reguardless of the trace
+            if (t instanceof Notification) {
+                throw (Notification)t;
             }
+
+            // Otherwise wrap to preserve the trace
+            throw new CommandExecutionFailied(t);
         }
 
         return ref.get();