]> git.mxchange.org Git - jphone-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 13 Mar 2018 20:57:08 +0000 (21:57 +0100)
committerRoland Häder <roland@mxchange.org>
Tue, 13 Mar 2018 20:57:08 +0000 (21:57 +0100)
- 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 <roland@mxchange.org>
src/org/mxchange/jphone/model/phonenumbers/mobileprovider/MobileProviders.java

index b31df0b213fd59298625e622bb1bf3b15bb62e7d..a97508141a539d638c1ac3c85287f0c04dced2e6 100644 (file)
@@ -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());