Commits

mbogaert  committed 519a709

Fixed WW-694: ExecuteAndWaitInterceptor can return null results

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@633573baa09-0c28-0410-bef9-dab3c582ae83

  • Participants
  • Parent commits 42b03f1

Comments (0)

Files changed (1)

File src/java/com/opensymphony/webwork/interceptor/ExecuteAndWaitInterceptor.java

                 session.remove(KEY + name);
                 actionInvocation.getStack().push(bp.getAction());
 
+                // if an exception occured during action execution, throw it here
+                if (bp.getException() != null) throw bp.getException();
+
                 return bp.getResult();
             }
         }
     static class BackgroundProcess implements Serializable {
         private Action action;
         private ActionInvocation invocation;
+
         private String result;
+        private Exception exception;
+
         private boolean done;
 
         public BackgroundProcess(final String threadName, final ActionInvocation invocation, final int threadPriority) {
             this.invocation = invocation;
             this.action = invocation.getAction();
 
-            Thread t = new Thread(new Runnable() {
+            final Thread t = new Thread(new Runnable() {
                 public void run() {
                     try {
                         result = action.execute();
                     } catch (Exception e) {
-                        e.printStackTrace();
+                        exception = e;
                     }
 
                     done = true;
             return result;
         }
 
+        public Exception getException() {
+            return exception;
+        }
+
         public boolean isDone() {
             return done;
         }