]> git.mxchange.org Git - juser-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 24 Apr 2020 14:53:03 +0000 (16:53 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 24 Apr 2020 14:53:03 +0000 (16:53 +0200)
- copyFooData() shall check if both source and target are not the same

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jusercore/model/user/Users.java

index d2b90aa3927fbe32be4274652a6cbf17d0c02c17..7a3a5cf332bf973caad20edfb0a31f3fd7c08972 100644 (file)
@@ -86,8 +86,8 @@ public class Users implements Serializable {
        }
 
        /**
-        * Compares both user instances. This method returns -1 if second
-        * instance is null.
+        * Compares both user instances. This method returns -1 if second instance
+        * is null.
         * <p>
         * @param user1 User instance 1
         * @param user2 User instance 2
@@ -125,6 +125,9 @@ public class Users implements Serializable {
                } else if (null == targetUser) {
                        // Throw NPE
                        throw new NullPointerException("targetUser is null"); //NOI18N
+               } else if (Objects.equals(sourceUser, targetUser)) {
+                       // Is exactly the same!
+                       throw new IllegalArgumentException("sourcerUser and targetUser are the same."); //NOI18N
                }
 
                // Is contact set?
@@ -274,7 +277,7 @@ public class Users implements Serializable {
        /**
         * Returns a formatted string from given user's locale and Date instance
         * <p>
-        * @param user     User instance
+        * @param user User instance
         * @param date Date instance
         * <p>
         * @return A formatted string from Date instance