You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2010/08/25 03:22:52 UTC

svn commit: r988776 - in /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket: RequestCycle.java protocol/http/WebRequestCycle.java

Author: ivaynberg
Date: Wed Aug 25 01:22:52 2010
New Revision: 988776

URL: http://svn.apache.org/viewvc?rev=988776&view=rev
Log:

Issue: WICKET-2794

Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/RequestCycle.java
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/RequestCycle.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/RequestCycle.java?rev=988776&r1=988775&r2=988776&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/RequestCycle.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/RequestCycle.java Wed Aug 25 01:22:52 2010
@@ -1381,14 +1381,22 @@ public abstract class RequestCycle
 			}
 			else
 			{
-				// hmmm, we were already handling an exception! give up
-				log.error(
-					"unexpected exception when handling another exception: " + e.getMessage(), e);
+				onExceptionLoop(e);
 			}
 		}
 	}
 
 	/**
+	 * Called when we catch a {@link RuntimeException} while already handling another
+	 */
+	protected void onExceptionLoop(RuntimeException e)
+	{
+		// hmmm, we were already handling an exception! give up
+		log.error("unexpected exception when handling another exception: " + e.getMessage(), e);
+
+	}
+
+	/**
 	 * INTERNAL. THIS METHOD IS NOT PART OF PUBLIC WICKET API. Do not call it. Returns whether
 	 * wicket handled this request or not (i.e. when no request target was found).
 	 * 

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java?rev=988776&r1=988775&r2=988776&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java Wed Aug 25 01:22:52 2010
@@ -16,6 +16,10 @@
  */
 package org.apache.wicket.protocol.http;
 
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+
 import org.apache.wicket.AbortException;
 import org.apache.wicket.IRedirectListener;
 import org.apache.wicket.MetaDataKey;
@@ -93,6 +97,21 @@ public class WebRequestCycle extends Req
 		return ((WebApplication)getApplication()).getRequestCycleProcessor();
 	}
 
+	@Override
+	protected void onExceptionLoop(RuntimeException e)
+	{
+		super.onExceptionLoop(e);
+		try
+		{
+			getWebResponse().getHttpServletResponse().sendError(
+				HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null);
+		}
+		catch (IOException e1)
+		{
+			// ignore
+		}
+	}
+
 	/**
 	 * @return Request as a WebRequest
 	 */