From: Roland Häder Date: Sat, 5 Nov 2022 06:43:18 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=77af198fac064b6b2b2796b5126160b3e780a54c;p=juser-core.git Continued: - also check user's locale (equals() and hashCode()) --- 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;