From 32d0bb611e6804eefb3443929e1396d34321227a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 24 Apr 2020 16:52:18 +0200 Subject: [PATCH] Continued: - copyFooData() shall always 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/jphone/model/phonenumbers/fax/FaxNumbers.java | 3 +++ .../jphone/model/phonenumbers/landline/LandLineNumbers.java | 3 +++ .../jphone/model/phonenumbers/mobile/MobileNumbers.java | 3 +++ 3 files changed, 9 insertions(+) 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 -- 2.39.5