You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/12/16 14:48:43 UTC
wicket git commit: WICKET-5776 Add information about the component
when it fail in detach phase
Repository: wicket
Updated Branches:
refs/heads/master c2a4dd391 -> a1fcd92d5
WICKET-5776 Add information about the component when it fail in detach phase
try/catch the application related logic in Component#detach()
(cherry picked from commit 39b65ecf1ce4a3904227a9dbdec9f8ca874f8a7e)
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a1fcd92d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a1fcd92d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a1fcd92d
Branch: refs/heads/master
Commit: a1fcd92d5b5c0f65a0966b5ae0a572136047132d
Parents: c2a4dd3
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Dec 16 15:44:09 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Dec 16 15:46:11 2014 +0200
----------------------------------------------------------------------
.../main/java/org/apache/wicket/Component.java | 35 ++++++++++++--------
1 file changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/a1fcd92d/wicket-core/src/main/java/org/apache/wicket/Component.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java
index 6ef7b6b..097e3d9 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -1156,23 +1156,30 @@ public abstract class Component
@Override
public final void detach()
{
- setFlag(FLAG_DETACHING, true);
- onDetach();
- if (getFlag(FLAG_DETACHING))
+ try
{
- throw new IllegalStateException(Component.class.getName() +
- " has not been properly detached. Something in the hierarchy of " +
- getClass().getName() +
- " has not called super.onDetach() in the override of onDetach() method");
- }
+ setFlag(FLAG_DETACHING, true);
+ onDetach();
+ if (getFlag(FLAG_DETACHING))
+ {
+ throw new IllegalStateException(Component.class.getName() +
+ " has not been properly detached. Something in the hierarchy of " +
+ getClass().getName() +
+ " has not called super.onDetach() in the override of onDetach() method");
+ }
- // always detach models because they can be attached without the
- // component. eg component has a compoundpropertymodel and one of its
- // children component's getmodelobject is called
- detachModels();
+ // always detach models because they can be attached without the
+ // component. eg component has a compoundpropertymodel and one of its
+ // children component's getmodelobject is called
+ detachModels();
- // detach any behaviors
- new Behaviors(this).detach();
+ // detach any behaviors
+ new Behaviors(this).detach();
+ }
+ catch (Exception x)
+ {
+ throw new WicketRuntimeException("An error occurred while detaching component: " + toString(true), x);
+ }
// always detach children because components can be attached
// independently of their parents