This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git

commit 05de3cfa3c4d65725ba86c37dc25ec8c1f8ddfe7
Author: jeho0815 <jeho0...@email.com>
AuthorDate: Wed Feb 7 17:08:20 2018 +0800

    [SCB-315] Resolve the Registry-Service UT test fail
---
 .../foundation/vertx/AddressResolverConfig.java       | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
index bf19919..90f3865 100644
--- 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
+++ 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
@@ -109,9 +109,7 @@ public class AddressResolverConfig {
 
   private static List<String> getStringListProperty(Configuration configSource,
       List<String> defaultValue, String... keys) {
-    if (configSource == null && 
DynamicPropertyFactory.getBackingConfigurationSource() != null) {
-      configSource = (Configuration) 
DynamicPropertyFactory.getBackingConfigurationSource();
-    }
+    configSource = guardConfigSource(configSource);
     if (configSource == null) {
       return defaultValue;
     }
@@ -125,9 +123,7 @@ public class AddressResolverConfig {
   }
 
   private static int getPositiveIntProperty(Configuration configSource, int 
defaultValue, String... keys) {
-    if (configSource == null && 
DynamicPropertyFactory.getBackingConfigurationSource() != null) {
-      configSource = (Configuration) 
DynamicPropertyFactory.getBackingConfigurationSource();
-    }
+    configSource = guardConfigSource(configSource);
     if (configSource == null) {
       return defaultValue;
     }
@@ -146,9 +142,7 @@ public class AddressResolverConfig {
 
   private static boolean getBooleanProperty(Configuration configSource, 
boolean defaultValue,
       String... keys) {
-    if (configSource == null && 
DynamicPropertyFactory.getBackingConfigurationSource() != null) {
-      configSource = (Configuration) 
DynamicPropertyFactory.getBackingConfigurationSource();
-    }
+    configSource = guardConfigSource(configSource);
     if (configSource == null) {
       return defaultValue;
     }
@@ -160,4 +154,11 @@ public class AddressResolverConfig {
     }
     return defaultValue;
   }
+
+  private static Configuration guardConfigSource(Configuration configSource) {
+    if (configSource == null && 
DynamicPropertyFactory.getBackingConfigurationSource() != null) {
+      configSource = (Configuration) 
DynamicPropertyFactory.getBackingConfigurationSource();
+    }
+    return configSource;
+  }
 }

-- 
To stop receiving notification emails like this one, please contact
ningji...@apache.org.

Reply via email to