From: Roland Häder Date: Fri, 24 Apr 2020 14:52:18 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=32d0bb611e6804eefb3443929e1396d34321227a;p=jphone-core.git Continued: - copyFooData() shall always check if both source and target are not the same Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java index 28347fa..7ad2b88 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java +++ b/src/org/mxchange/jphone/model/phonenumbers/fax/FaxNumbers.java @@ -45,6 +45,9 @@ public class FaxNumbers implements Serializable { } else if (null == targetNumber) { // Throw NPE throw new NullPointerException("targetNumber is null"); //NOI18N + } else if (Objects.equals(sourceNumber, targetNumber)) { + // Is exactly the same! + throw new IllegalArgumentException("sourcerNumber and targetNumber are the same."); //NOI18N } // Copy all diff --git a/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java index bc92e5c..46abe5c 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java +++ b/src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumbers.java @@ -45,6 +45,9 @@ public class LandLineNumbers implements Serializable { } else if (null == targetNumber) { // Throw NPE throw new NullPointerException("targetNumber is null"); //NOI18N + } else if (Objects.equals(sourceNumber, targetNumber)) { + // Is exactly the same! + throw new IllegalArgumentException("sourcerNumber and targetNumber are the same."); //NOI18N } // Copy all diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java index b6c0d5b..da76d40 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java +++ b/src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumbers.java @@ -45,6 +45,9 @@ public class MobileNumbers implements Serializable { } else if (null == targetNumber) { // Throw NPE throw new NullPointerException("targetNumber is null"); //NOI18N + } else if (Objects.equals(sourceNumber, targetNumber)) { + // Is exactly the same! + throw new IllegalArgumentException("sourcerNumber and targetNumber are the same."); //NOI18N } // Copy all fields