You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by da...@apache.org on 2015/09/21 13:06:08 UTC
[2/3] wicket git commit: Improved child already exists error message
Improved child already exists error message
Added the type of the previously existing component.
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/76cd2266
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/76cd2266
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/76cd2266
Branch: refs/heads/WICKET-5981
Commit: 76cd22665ff2eb572ea9165af4581050fd304beb
Parents: 7be920d
Author: Martijn Dashorst <ma...@gmail.com>
Authored: Mon Sep 21 13:02:24 2015 +0200
Committer: Martijn Dashorst <ma...@gmail.com>
Committed: Mon Sep 21 13:02:24 2015 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/wicket/MarkupContainer.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/76cd2266/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
index 4571c29..8bbb1fa 100644
--- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
@@ -194,11 +194,13 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
parent.remove(child);
}
- // Add to map
- if (put(child) != null)
+ // Add the child to my children
+ Component previousChild = put(child);
+ if (previousChild != null)
{
- throw new IllegalArgumentException(exceptionMessage("A child with id '"
- + child.getId() + "' already exists"));
+ throw new IllegalArgumentException(
+ exceptionMessage("A child '" + previousChild.getClass().getSimpleName() +
+ "' with id '" + child.getId() + "' already exists"));
}
addedComponent(child);