From 1f43c64f94f01d92abb9db8e2e24bfff6e94cbf0 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 18 Apr 2016 21:18:42 +0200 Subject: [PATCH] Continued a bit: - Use Objects.equals() as it is more safe (NPE-free) - add updated user instance to full admin list --- .../beans/user/AddressbookAdminUserWebSessionBean.java | 3 +++ .../addressbook/beans/user/AddressbookUserWebSessionBean.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java index 40e9e3e7..ff99674c 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebSessionBean.java @@ -350,6 +350,9 @@ public class AddressbookAdminUserWebSessionBean implements AddressbookAdminUserW // Fire event this.addedUserEvent.fire(new AdminUserAddedEvent(updatedUser)); + // Add user to local list + this.userList.add(updatedUser); + // Clear all this.clear(); } diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java index 7b6b424e..6c8e6c88 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java @@ -261,7 +261,7 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N - } else if (event.getRegisteredUser()== null) { + } else if (event.getRegisteredUser() == null) { // Throw NPE again throw new NullPointerException("event.user is null"); //NOI18N } else if (event.getRegisteredUser().getUserId() == null) { @@ -291,7 +291,7 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC this.setUserId(registeredUser.getUserId()); // Is the account public? - if (registeredUser.getUserProfileMode().equals(ProfileMode.PUBLIC)) { + if (Objects.equals(registeredUser.getUserProfileMode(), ProfileMode.PUBLIC)) { // Also add it to this list this.visibleUserList.add(registeredUser); } -- 2.39.5