From 19a59d4e90a256a36ccdac7bfb9ee7a2744ba6f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 13 Mar 2018 21:57:08 +0100 Subject: [PATCH] Continued: - country.copyAll() is no more available - had to switch to Countries.copyCountry() which follows a general guideline to have static utility methods - also included a check on equality of both source and target mobile providers, if both are the same this indicates that there is a logic mistake that needs investigation and fixing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/phonenumbers/mobileprovider/MobileProviders.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java index b31df0b..a975081 100644 --- a/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java +++ b/src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java @@ -17,6 +17,8 @@ package org.mxchange.jphone.model.phonenumbers.mobileprovider; import java.io.Serializable; +import java.util.Objects; +import org.mxchange.jcountry.model.data.Countries; /** * An utilities class for mobile providers @@ -44,10 +46,13 @@ public class MobileProviders implements Serializable { } else if (null == targetMobileProvider) { // Throw NPE throw new NullPointerException("targetMobileProvider is null"); //NOI18N + } else if (Objects.equals(sourceMobileProvider, targetMobileProvider)) { + // Is same mobile provider + throw new IllegalArgumentException("Source and target mobile provider are the same."); //NOI18N } // Copy all values - targetMobileProvider.getProviderCountry().copyAll(sourceMobileProvider.getProviderCountry()); + Countries.copyCountry(sourceMobileProvider.getProviderCountry(), targetMobileProvider.getProviderCountry()); targetMobileProvider.setProviderDialPrefix(sourceMobileProvider.getProviderDialPrefix()); targetMobileProvider.setProviderEntryCreated(sourceMobileProvider.getProviderEntryCreated()); targetMobileProvider.setProviderId(sourceMobileProvider.getProviderId()); -- 2.39.5