Browse Source

Improve error message when reusing UI instance (#13457)

Change-Id: I49ec1e837a1a2a04dfadef5fd5fb5b6fd10ffcbc
tags/7.1.13
Leif Åstrand 10 years ago
parent
commit
7cab7fd80f
1 changed files with 12 additions and 1 deletions
  1. 12
    1
      server/src/com/vaadin/ui/UI.java

+ 12
- 1
server/src/com/vaadin/ui/UI.java View File

@@ -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;


Loading…
Cancel
Save