]> git.mxchange.org Git - juser-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 5 Nov 2022 06:43:18 +0000 (07:43 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 5 Nov 2022 06:43:18 +0000 (07:43 +0100)
- also check user's locale (equals() and hashCode())

src/org/mxchange/jusercore/model/user/LoginUser.java
src/org/mxchange/jusercore/model/utils/UserUtils.java

index 9a3b346d43684b9db7b67dc33e9072083eb3eea9..5d058178960404b8b8b3b70faa66dd54ce22e682 100644 (file)
@@ -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;
        }
index 6a21724bec2ec160f604b2c6d758ad430d65b7e3..048c3a26ea10416f3cee1f1adeeb7fc8c77b5848 100644 (file)
@@ -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;