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

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontacts/model/contact/Contacts.java

index b1f34d12ac2e0b9d20bb681b974a24366f67f076..02dc965a61bca6b565c4b04e3eff334857bbccea 100644 (file)
@@ -79,6 +79,9 @@ public class Contacts implements Serializable {
                } else if (null == targetContact) {
                        // Throw NPE
                        throw new NullPointerException("targetContact is null"); //NOI18N
+               } else if (Objects.equals(sourceContact, targetContact)) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("sourceContact and targetContact are the same."); //NOI18N
                }
 
                // Copy all: