From a3b3020e5fc79a4e685c35389e966a7f8927243a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 24 Apr 2020 16:53:03 +0200 Subject: [PATCH] Continued: - copyFooData() shall check if both source and target are not the same MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- src/org/mxchange/jusercore/model/user/Users.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 -- 2.39.5