diff options
author | Leif Åstrand <leif@vaadin.com> | 2014-03-13 13:23:21 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-03-13 21:44:50 +0000 |
commit | 7cab7fd80f85b9a7846b1d771aa3dce592ae5d42 (patch) | |
tree | a8f9399509089865a463e460f3ebb0bedbfd1c4f /server | |
parent | 7e7b6239ca8867d13e8d8b279a0541bfd71466f7 (diff) | |
download | vaadin-framework-7cab7fd80f85b9a7846b1d771aa3dce592ae5d42.tar.gz vaadin-framework-7cab7fd80f85b9a7846b1d771aa3dce592ae5d42.zip |
Improve error message when reusing UI instance (#13457)
Change-Id: I49ec1e837a1a2a04dfadef5fd5fb5b6fd10ffcbc
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/UI.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 746fa194ac..0412cb1882 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -601,7 +601,18 @@ public abstract class UI extends AbstractSingleComponentContainer implements */ public void doInit(VaadinRequest request, int uiId) { if (this.uiId != -1) { - throw new IllegalStateException("UI id has already been defined"); + String message = "This UI instance is already initialized (as UI id " + + this.uiId + + ") and can therefore not be initialized again (as UI id " + + uiId + "). "; + + if (getSession() != null + && !getSession().equals(VaadinSession.getCurrent())) { + message += "Furthermore, it is already attached to another VaadinSession. "; + } + message += "Please make sure you are not accidentally reusing an old UI instance."; + + throw new IllegalStateException(message); } this.uiId = uiId; |