public void setSession(VaadinServiceSession session) {
if ((session == null) == (this.session == null)) {
throw new IllegalStateException(
- "VaadinSession has already been set");
+ "VaadinServiceSession has already been set. Old session: "
+ + getSessionDetails(this.session)
+ + ". New session: " + getSessionDetails(session)
+ + ".");
} else {
if (session == null) {
detach();
}
}
+ private static String getSessionDetails(VaadinServiceSession session) {
+ if (session == null) {
+ return null;
+ } else {
+ return session.toString() + " for "
+ + session.getService().getServiceName();
+ }
+ }
+
/**
* Gets the id of the UI, used to identify this UI within its application
* when processing requests. The UI id should be present in every request to