summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2014-03-12 21:17:18 +0200
committerArtur Signell <artur@vaadin.com>2014-05-22 09:52:42 +0000
commit95e563a69b540bae2616466ae25646eba50d4afe (patch)
tree9a011e0417ee06f1ee7648da6975a19ec0401316 /server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
parenta11909909c895032ca5f8b271dfb0fa29efa2a6f (diff)
downloadvaadin-framework-95e563a69b540bae2616466ae25646eba50d4afe.tar.gz
vaadin-framework-95e563a69b540bae2616466ae25646eba50d4afe.zip
Prevent adding/setting parent component as child (#12720).
Change-Id: I9b7b43f176e88d9edca591001297b94475a31854
Diffstat (limited to 'server/src/com/vaadin/ui/AbstractSingleComponentContainer.java')
-rw-r--r--server/src/com/vaadin/ui/AbstractSingleComponentContainer.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
index de1bb29846..ba108fc302 100644
--- a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
+++ b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
@@ -123,6 +123,12 @@ public abstract class AbstractSingleComponentContainer extends
*/
@Override
public void setContent(Component content) {
+ // Make sure we're not adding the component inside it's own content
+ if (isOrHasAncestor(content)) {
+ throw new IllegalArgumentException(
+ "Component cannot be added inside it's own content");
+ }
+
Component oldContent = getContent();
if (oldContent == content) {
// do not set the same content twice