You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/08/31 07:31:55 UTC

svn commit: r264946 - in /beehive/trunk/netui: src/pageflow/org/apache/beehive/netui/pageflow/ test/webapps/drt/coreWeb/miniTests/exceptionHandlerThrows/ test/webapps/drt/testRecorder/config/

Author: rich
Date: Tue Aug 30 22:31:41 2005
New Revision: 264946

URL: http://svn.apache.org/viewcvs?rev=264946&view=rev
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-903 : Incoherent error message when an exception handler method throws an unhandled exception

tests: bvt in netui (WinXP)
BB: self (linux)


Added:
    beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/exceptionHandlerThrows/
    beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/exceptionHandlerThrows/Controller.jpf   (with props)
Modified:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
    beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java?rev=264946&r1=264945&r2=264946&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java Tue Aug 30 22:31:41 2005
@@ -28,6 +28,7 @@
 import org.apache.beehive.netui.pageflow.internal.InternalConstants;
 import org.apache.beehive.netui.pageflow.internal.InternalExpressionUtils;
 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
+import org.apache.beehive.netui.pageflow.internal.UnhandledException;
 import org.apache.beehive.netui.pageflow.scoping.ScopedRequest;
 import org.apache.beehive.netui.util.internal.FileUtils;
 import org.apache.beehive.netui.util.internal.InternalStringBuilder;
@@ -1404,7 +1405,7 @@
                 if ( ex instanceof ServletException ) throw ( ServletException ) ex;
                 if ( ex instanceof IOException ) throw ( IOException ) ex;
                 if ( ex instanceof Error ) throw ( Error ) ex;
-                throw new ServletException( ex );
+                throw new UnhandledException( ex );
             }
             
             return null;
@@ -1856,11 +1857,11 @@
         // Remove any messages attribute if none are required
         if ( errors == null || errors.isEmpty() )
         {
-            getRequest().removeAttribute( Globals.MESSAGE_KEY );
+            getRequest().removeAttribute( Globals.ERROR_KEY );
         }
         else
         {
-            getRequest().setAttribute( Globals.MESSAGE_KEY, errors );
+            getRequest().setAttribute( Globals.ERROR_KEY, errors );
         }
     }
 

Added: beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/exceptionHandlerThrows/Controller.jpf
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/exceptionHandlerThrows/Controller.jpf?rev=264946&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/exceptionHandlerThrows/Controller.jpf (added)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/exceptionHandlerThrows/Controller.jpf Tue Aug 30 22:31:41 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package miniTests.exceptionHandlerThrows;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+@Jpf.Controller(
+    catches={
+        @Jpf.Catch(type=Exception.class, method="handleIt")
+    }
+)
+public class Controller extends PageFlowController
+{
+    @Jpf.Action
+    public Forward begin()
+    {
+        throw new IllegalStateException("intentional");
+    }
+
+    @Jpf.ExceptionHandler
+    public Forward handleIt(Exception ex, String actionName, String message, Object formBean)
+    {
+        throw new UnsupportedOperationException("another intentional exception");
+    }
+}

Propchange: beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/exceptionHandlerThrows/Controller.jpf
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?rev=264946&r1=264945&r2=264946&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (original)
+++ beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Tue Aug 30 22:31:41 2005
@@ -3750,6 +3750,17 @@
          </features>
       </test>
       <test>
+         <name>ExceptionHandlerThrows</name>
+         <description>MANUAL test to ensure that something rational happens (container error page with the right stacktrace) when an exception handler method throws a runtime exception.</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>manualTests</category>
+         </categories>
+         <features>
+            <feature>Exceptions</feature>
+         </features>
+      </test>
+      <test>
          <name>ExceptionMessages</name>
          <description>Test of the 'message' and 'messageKey' attributes on @Jpf.Catch.</description>
          <webapp>coreWeb</webapp>