aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2009-02-16 19:26:01 +0000
committerArtur Signell <artur.signell@itmill.com>2009-02-16 19:26:01 +0000
commit3fc6d4da23e35f6bf63c9aa968ca919dedd45586 (patch)
treee86352042e66ddcac052bf6ebba6ae64e594ffe0
parentd1d56efde65005665659847a85f749406826821d (diff)
downloadvaadin-framework-3fc6d4da23e35f6bf63c9aa968ca919dedd45586.tar.gz
vaadin-framework-3fc6d4da23e35f6bf63c9aa968ca919dedd45586.zip
Fix for #2597 - NPE in Application.setUser
svn changeset:6864/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/Application.java33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/com/itmill/toolkit/Application.java b/src/com/itmill/toolkit/Application.java
index ad51911ed7..1b3f184382 100644
--- a/src/com/itmill/toolkit/Application.java
+++ b/src/com/itmill/toolkit/Application.java
@@ -420,16 +420,18 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
*/
public void setUser(Object user) {
final Object prevUser = this.user;
- if (user != prevUser && (user == null || !user.equals(prevUser))) {
- this.user = user;
- if (userChangeListeners != null) {
- final Object[] listeners = userChangeListeners.toArray();
- final UserChangeEvent event = new UserChangeEvent(this, user,
- prevUser);
- for (int i = 0; i < listeners.length; i++) {
- ((UserChangeListener) listeners[i])
- .applicationUserChanged(event);
- }
+ if (user == prevUser || (user != null && user.equals(prevUser))) {
+ return;
+ }
+
+ this.user = user;
+ if (userChangeListeners != null) {
+ final Object[] listeners = userChangeListeners.toArray();
+ final UserChangeEvent event = new UserChangeEvent(this, user,
+ prevUser);
+ for (int i = 0; i < listeners.length; i++) {
+ ((UserChangeListener) listeners[i])
+ .applicationUserChanged(event);
}
}
}
@@ -1348,11 +1350,12 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
* </p>
* <p>
* The default behavior is to show a notification, and restart the
- * application the the user clicks the message. <br/> Instead of restarting
- * the application, you can set a specific URL that the user is taken
- * to.<br/> Setting both caption and message to null will restart the
- * application (or go to the specified URL) without displaying a
- * notification. set*NotificationEnabled(false) will achieve the same thing.
+ * application the the user clicks the message. <br/>
+ * Instead of restarting the application, you can set a specific URL that
+ * the user is taken to.<br/>
+ * Setting both caption and message to null will restart the application (or
+ * go to the specified URL) without displaying a notification.
+ * set*NotificationEnabled(false) will achieve the same thing.
* </p>
* <p>
* The situations are: