You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/02/08 10:28:20 UTC

[incubator-servicecomb-java-chassis] 01/02: [SCB-315] Resolve the Registry-Service UT test fail

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 5c0ff5fca79643dc9c5c4ba37d6a631688fd539e
Author: jeho0815 <je...@email.com>
AuthorDate: Sat Feb 3 16:35:26 2018 +0800

    [SCB-315] Resolve the Registry-Service UT test fail
---
 .../foundation/vertx/AddressResolverConfig.java           | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 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 1b1a804..bf19919 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,12 @@ public class AddressResolverConfig {
 
   private static List<String> getStringListProperty(Configuration configSource,
       List<String> defaultValue, String... keys) {
-    if (configSource == null) {
+    if (configSource == null && DynamicPropertyFactory.getBackingConfigurationSource() != null) {
       configSource = (Configuration) DynamicPropertyFactory.getBackingConfigurationSource();
     }
+    if (configSource == null) {
+      return defaultValue;
+    }
     for (String key : keys) {
       String[] vals = configSource.getStringArray(key);
       if (vals != null && vals.length > 0) {
@@ -122,9 +125,12 @@ public class AddressResolverConfig {
   }
 
   private static int getPositiveIntProperty(Configuration configSource, int defaultValue, String... keys) {
-    if (configSource == null) {
+    if (configSource == null && DynamicPropertyFactory.getBackingConfigurationSource() != null) {
       configSource = (Configuration) DynamicPropertyFactory.getBackingConfigurationSource();
     }
+    if (configSource == null) {
+      return defaultValue;
+    }
     for (String key : keys) {
       Integer val = configSource.getInteger(key, null);
       if (val != null && val <= 0) {
@@ -140,9 +146,12 @@ public class AddressResolverConfig {
 
   private static boolean getBooleanProperty(Configuration configSource, boolean defaultValue,
       String... keys) {
-    if (configSource == null) {
+    if (configSource == null && DynamicPropertyFactory.getBackingConfigurationSource() != null) {
       configSource = (Configuration) DynamicPropertyFactory.getBackingConfigurationSource();
     }
+    if (configSource == null) {
+      return defaultValue;
+    }
     for (String key : keys) {
       Boolean val = configSource.getBoolean(key, null);
       if (val != null) {

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