You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2007/01/31 17:48:11 UTC
svn commit: r501893 - in /beehive/trunk/netui:
src/pageflow/org/apache/beehive/netui/pageflow/
test/webapps/drt/src/bugs/j1130/ test/webapps/drt/testRecorder/config/
test/webapps/drt/testRecorder/tests/ test/webapps/drt/web/bugs/j1130/
Author: crogers
Date: Wed Jan 31 08:48:09 2007
New Revision: 501893
URL: http://svn.apache.org/viewvc?view=rev&rev=501893
Log:
Fix for BEEHIVE-1130 - ClassCastException in the DefaultExceptionsHandler when handling JSP rendering exceptions on a direct call to a JSP. We now make sure the request is wrapped as a PageFlowRequestWrapper. I've added a new test case to cover this condition.
Tests: NetUI BVT (WinXP passed)
Added:
beehive/trunk/netui/test/webapps/drt/src/bugs/j1130/
beehive/trunk/netui/test/webapps/drt/src/bugs/j1130/Controller.java (with props)
beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J1130.xml (with props)
beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/
beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/error.jsp (with props)
beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/index.jsp (with props)
Modified:
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java?view=diff&rev=501893&r1=501892&r2=501893
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java Wed Jan 31 08:48:09 2007
@@ -471,16 +471,23 @@
HttpServletRequest request,
HttpServletResponse response )
{
- try
- {
- ActionMapping mapping = InternalUtils.getCurrentActionMapping( request );
- ActionForm form = InternalUtils.getCurrentActionForm( request );
- ActionForward fwd = fc.handleException( th, mapping, form, request, response );
- fc.getRequestProcessor().doActionForward( request, response, fwd );
+ try {
+ //
+ // Make sure the request is wrapped so we can mark that an exception
+ // is already being handled.
+ //
+ PageFlowRequestWrapper rw = PageFlowRequestWrapper.unwrap(request);
+ if (rw == null) {
+ request = PageFlowRequestWrapper.wrapRequest(request);
+ }
+
+ ActionMapping mapping = InternalUtils.getCurrentActionMapping(request);
+ ActionForm form = InternalUtils.getCurrentActionForm(request);
+ ActionForward fwd = fc.handleException(th, mapping, form, request, response);
+ fc.getRequestProcessor().doActionForward(request, response, fwd);
return true;
}
- catch ( Throwable t )
- {
+ catch (Throwable t) {
LOG.error("Exception occurred while handling exception " + th.getClass().getName()
+ ". The original exception will be thrown. Cause: " + t, t);
return false;
Added: beehive/trunk/netui/test/webapps/drt/src/bugs/j1130/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/bugs/j1130/Controller.java?view=auto&rev=501893
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/bugs/j1130/Controller.java (added)
+++ beehive/trunk/netui/test/webapps/drt/src/bugs/j1130/Controller.java Wed Jan 31 08:48:09 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 bugs.j1130;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.netui.pageflow.Forward;
+
+@Jpf.Controller(
+ simpleActions = {
+ @Jpf.SimpleAction(name = "begin", path = "index.jsp")
+ },
+ catches = {
+ @Jpf.Catch(
+ type = java.lang.IllegalStateException.class,
+ method = "testExceptionHandler",
+ message="Caught a test exception!")
+ }
+)
+public class Controller extends PageFlowController {
+ private String _message = null;
+
+ public String getMessage() {
+ return _message;
+ }
+
+ // bogus property to throw exception from JSP
+ public String getPropertyThrowException() {
+ throw new IllegalStateException( "exception thrown in page flow" );
+ }
+
+ @Jpf.ExceptionHandler(
+ forwards = {
+ @Jpf.Forward(
+ name = "handleError",
+ path = "error.jsp")
+ })
+ protected Forward testExceptionHandler(java.lang.IllegalStateException ex,
+ String actionName,
+ String message, Object form) {
+ _message = "..." + ex;
+ return new Forward("handleError");
+ }
+}
Propchange: beehive/trunk/netui/test/webapps/drt/src/bugs/j1130/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?view=diff&rev=501893&r1=501892&r2=501893
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (original)
+++ beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Wed Jan 31 08:48:09 2007
@@ -5268,6 +5268,16 @@
</categories>
</test>
<test>
+ <name>J1130</name>
+ <description>PageFlowPageFilter exception handling test for non PageFlowRequestWrapper requests (BEEHIVE-1130). Make request directly to JSP that throws exception.</description>
+ <webapp>coreWeb</webapp>
+ <categories>
+ <category>bvt</category>
+ <category>bvt.struts11</category>
+ <category>jiraBugs</category>
+ </categories>
+ </test>
+ <test>
<name>JpfScopedFormsTest49</name>
<description>JpfScopedFormsTest49</description>
<webapp>coreWeb</webapp>
Added: beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J1130.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J1130.xml?view=auto&rev=501893
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J1130.xml (added)
+++ beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J1130.xml Wed Jan 31 08:48:09 2007
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<recorderSession xmlns="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+<sessionName>J1130</sessionName>
+<tester>crogers</tester>
+<startDate>30 Jan 2007, 10:25:58.308 PM MST</startDate>
+<description>PageFlowPageFilter exception handling test for non PageFlowRequestWrapper requests (BEEHIVE-1130). Make request directly to JSP that throws exception.</description>
+<tests>
+<test>
+<testNumber>1</testNumber>
+<request>
+<protocol>HTTP</protocol>
+<protocolVersion>1.1</protocolVersion>
+<host>localhost</host>
+<port>8080</port>
+<uri>/coreWeb/bugs/j1130/index.jsp</uri>
+<method>GET</method>
+<parameters>
+</parameters>
+<cookies>
+<cookie>
+<name>JSESSIONID</name>
+<value>3ED0FCA27C656C3D2E635DF8B13ADAE5</value>
+</cookie>
+</cookies>
+<headers>
+<header>
+<name>accept</name>
+<value>image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*</value>
+</header>
+<header>
+<name>accept-encoding</name>
+<value>gzip, deflate</value>
+</header>
+<header>
+<name>accept-language</name>
+<value>en-us,en-ca;q=0.5</value>
+</header>
+<header>
+<name>connection</name>
+<value>Keep-Alive</value>
+</header>
+<header>
+<name>cookie</name>
+<value>JSESSIONID=3ED0FCA27C656C3D2E635DF8B13ADAE5</value>
+</header>
+<header>
+<name>host</name>
+<value>localhost:8080</value>
+</header>
+<header>
+<name>user-agent</name>
+<value>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1)</value>
+</header>
+</headers>
+</request>
+<response>
+<statusCode>200</statusCode>
+<reason></reason>
+<responseBody>
+<![CDATA[<html>
+ <head>
+ <title>Page Filter Exception Handling Test</title>
+ </head>
+ <body>
+ <h1>Page Filter Exception Handling Test</h1>
+ <br>
+ Exception caught and handled...
+ <br>
+ ...java.lang.IllegalStateException: exception thrown in page flow
+ <br>
+ <a href="/coreWeb/bugs/j1130/begin.do">begin</a>
+ </body>
+</html>]]>
+</responseBody>
+</response>
+</test>
+</tests>
+<endDate>30 Jan 2007, 10:26:17.726 PM MST</endDate>
+<testCount>1</testCount>
+</recorderSession>
Propchange: beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J1130.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/error.jsp
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/error.jsp?view=auto&rev=501893
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/error.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/error.jsp Wed Jan 31 08:48:09 2007
@@ -0,0 +1,35 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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:$
+--%>
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+
+<html>
+ <head>
+ <title>Page Filter Exception Handling Test</title>
+ </head>
+ <body>
+ <h1>Page Filter Exception Handling Test</h1>
+ <br>
+ Exception caught and handled...
+ <br>
+ ${pageFlow.message}
+ <br>
+ <netui:anchor action="begin">begin</netui:anchor>
+ </body>
+</html>
Propchange: beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/error.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/index.jsp
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/index.jsp?view=auto&rev=501893
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/index.jsp (added)
+++ beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/index.jsp Wed Jan 31 08:48:09 2007
@@ -0,0 +1,34 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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:$
+--%>
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+
+<html>
+ <head>
+ <title>Page Filter Exception Handling Test</title>
+ </head>
+ <body>
+ <h1>Page Filter Exception Handling Test</h1>
+ <br>
+ This page throws an EL Exception here...
+ ${pageFlow.propertyThrowException}
+ <br>
+ <netui:anchor action="begin">begin</netui:anchor>
+ </body>
+</html>
Propchange: beehive/trunk/netui/test/webapps/drt/web/bugs/j1130/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native