From: Roland Häder <roland@mxchange.org>
Date: Fri, 24 Apr 2020 14:48:33 +0000 (+0200)
Subject: Continued:
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d3cc79ab9b87a3ab78c15cb17ec0ff82795732c2;p=jcontacts-core.git

Continued:
- copyFooData() should always check if both source and target are not the same
  before continuing

Signed-off-by: Roland Häder <roland@mxchange.org>
---

diff --git a/src/org/mxchange/jcontacts/model/contact/Contacts.java b/src/org/mxchange/jcontacts/model/contact/Contacts.java
index b1f34d1..02dc965 100644
--- a/src/org/mxchange/jcontacts/model/contact/Contacts.java
+++ b/src/org/mxchange/jcontacts/model/contact/Contacts.java
@@ -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: