From 77af198fac064b6b2b2796b5126160b3e780a54c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 5 Nov 2022 07:43:18 +0100 Subject: [PATCH] Continued: - also check user's locale (equals() and hashCode()) --- .../jusercore/model/user/LoginUser.java | 17 ++++++++++------- .../jusercore/model/utils/UserUtils.java | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/org/mxchange/jusercore/model/user/LoginUser.java b/src/org/mxchange/jusercore/model/user/LoginUser.java index 9a3b346..5d05817 100644 --- a/src/org/mxchange/jusercore/model/user/LoginUser.java +++ b/src/org/mxchange/jusercore/model/user/LoginUser.java @@ -260,20 +260,22 @@ public class LoginUser implements User { final User user = (User) object; - if (!Objects.equals(this.getUserName(), user.getUserName())) { - return false; - } else if (!Objects.equals(this.getUserAccountStatus(), user.getUserAccountStatus())) { + if (!Objects.equals(this.getUserAccountStatus(), user.getUserAccountStatus())) { return false; } else if (!Objects.equals(this.getUserConfirmKey(), user.getUserConfirmKey())) { return false; + } else if (!Objects.equals(this.getUserContact(), user.getUserContact())) { + return false; } else if (!Objects.equals(this.getUserId(), user.getUserId())) { return false; + } else if (!Objects.equals(this.getUserLocale(), user.getUserLocale())) { + return false; + } else if (!Objects.equals(this.getUserName(), user.getUserName())) { + return false; } else if (!Objects.equals(this.getUserMustChangePassword(), user.getUserMustChangePassword())) { return false; } else if (!Objects.equals(this.getUserProfileMode(), user.getUserProfileMode())) { return false; - } else if (!Objects.equals(this.getUserContact(), user.getUserContact())) { - return false; } return true; @@ -419,13 +421,14 @@ public class LoginUser implements User { public int hashCode () { int hash = 5; - hash = 83 * hash + Objects.hashCode(this.getUserName()); hash = 83 * hash + Objects.hashCode(this.getUserAccountStatus()); hash = 83 * hash + Objects.hashCode(this.getUserConfirmKey()); + hash = 83 * hash + Objects.hashCode(this.getUserContact()); hash = 83 * hash + Objects.hashCode(this.getUserId()); + hash = 83 * hash + Objects.hashCode(this.getUserLocale()); hash = 83 * hash + Objects.hashCode(this.getUserMustChangePassword()); + hash = 83 * hash + Objects.hashCode(this.getUserName()); hash = 83 * hash + Objects.hashCode(this.getUserProfileMode()); - hash = 83 * hash + Objects.hashCode(this.getUserContact()); return hash; } diff --git a/src/org/mxchange/jusercore/model/utils/UserUtils.java b/src/org/mxchange/jusercore/model/utils/UserUtils.java index 6a21724..048c3a2 100644 --- a/src/org/mxchange/jusercore/model/utils/UserUtils.java +++ b/src/org/mxchange/jusercore/model/utils/UserUtils.java @@ -157,7 +157,7 @@ public class UserUtils implements Serializable { */ public static String generateRandomUserName () { // User name's format is normally "user" + random number (10 digits) - String userName = String.format("user%d", RANDOM_NUMBER_GENERATOR.nextInt(10000000)); //NOI18N + final String userName = String.format("user%d", RANDOM_NUMBER_GENERATOR.nextInt(10000000)); //NOI18N // Return it return userName; -- 2.39.5