You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mo...@apache.org on 2015/11/29 17:05:37 UTC

[11/33] wicket git commit: WICKET-6001 Exception raised while refreshing a page with queued components missing in the markup

WICKET-6001 Exception raised while refreshing a page with queued components missing in the markup


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/67b53cf0
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/67b53cf0
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/67b53cf0

Branch: refs/heads/lambdas
Commit: 67b53cf0de66fb8f41a10831e96168b29ab240f2
Parents: a9e79e8
Author: Andrea Del Bene <ad...@apache.org>
Authored: Mon Nov 16 12:58:59 2015 +0100
Committer: Andrea Del Bene <ad...@apache.org>
Committed: Mon Nov 16 12:58:59 2015 +0100

----------------------------------------------------------------------
 .../wicket/request/cycle/RequestCycle.java      | 27 ++++++++++++++++++++
 .../wicket/request/RequestHandlerStack.java     |  4 +++
 2 files changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/67b53cf0/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java b/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
index 04baf9e..f0e4ff0 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java
@@ -640,6 +640,10 @@ public class RequestCycle implements IRequestCycle, IEventSink
 		{
 			requestHandlerExecutor.detach();
 		}
+		catch (RuntimeException exception)
+		{
+			handleDetachException(exception);
+		}
 		finally
 		{
 			listeners.onDetach(this);
@@ -653,6 +657,29 @@ public class RequestCycle implements IRequestCycle, IEventSink
 	}
 
 	/**
+	 * Called to handle a {@link java.lang.RuntimeException} that might be 
+	 * thrown during detaching phase. 
+	 * 
+	 * @param exception
+	 */
+	private void handleDetachException(RuntimeException exception) 
+	{
+		boolean isBufferedResponse = Application.get().
+				getRequestCycleSettings().getBufferResponse();
+		
+		//if application is using a buffered response strategy,
+		//then we display exception to user.
+		if (isBufferedResponse) 
+		{
+			throw exception;
+		}
+		else 
+		{
+			log.error("Error detaching RequestCycle", exception);
+		}
+	}
+
+	/**
 	 * Convenience method for setting next page to be rendered.
 	 * 
 	 * @param page

http://git-wip-us.apache.org/repos/asf/wicket/blob/67b53cf0/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java
index 782f1ea..e3cbb33 100644
--- a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java
+++ b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java
@@ -179,6 +179,10 @@ public abstract class RequestHandlerStack
 			{
 				detach(handler);
 			}
+			catch (RuntimeException exception)
+			{
+				throw exception;
+			}
 			catch (Exception exception)
 			{
 				log.error("Error detaching RequestHandler", exception);