From: Roland Häder Date: Fri, 24 Apr 2020 14:53:03 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a3b3020e5fc79a4e685c35389e966a7f8927243a;p=juser-core.git Continued: - copyFooData() shall check if both source and target are not the same Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jusercore/model/user/Users.java b/src/org/mxchange/jusercore/model/user/Users.java index d2b90aa..7a3a5cf 100644 --- a/src/org/mxchange/jusercore/model/user/Users.java +++ b/src/org/mxchange/jusercore/model/user/Users.java @@ -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. *

* @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 *

- * @param user User instance + * @param user User instance * @param date Date instance *

* @return A formatted string from Date instance