From: Roland Häder Date: Tue, 13 Mar 2018 20:57:08 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=19a59d4e90a256a36ccdac7bfb9ee7a2744ba6f5;p=jphone-core.git 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 Signed-off-by: Roland Häder --- 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());