WillemJiang closed pull request #549: [SCB-315] Resolve the Registry-Service UT
test fail
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/549
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 1b1a80481..90f3865da 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,8 +109,9 @@ public static AddressResolverOptions
getAddressResover(String tag, Configuration
private static List<String> getStringListProperty(Configuration configSource,
List<String> defaultValue, String... keys) {
+ configSource = guardConfigSource(configSource);
if (configSource == null) {
- configSource = (Configuration)
DynamicPropertyFactory.getBackingConfigurationSource();
+ return defaultValue;
}
for (String key : keys) {
String[] vals = configSource.getStringArray(key);
@@ -122,8 +123,9 @@ public static AddressResolverOptions
getAddressResover(String tag, Configuration
}
private static int getPositiveIntProperty(Configuration configSource, int
defaultValue, String... keys) {
+ configSource = guardConfigSource(configSource);
if (configSource == null) {
- configSource = (Configuration)
DynamicPropertyFactory.getBackingConfigurationSource();
+ return defaultValue;
}
for (String key : keys) {
Integer val = configSource.getInteger(key, null);
@@ -140,8 +142,9 @@ private static int getPositiveIntProperty(Configuration
configSource, int defaul
private static boolean getBooleanProperty(Configuration configSource,
boolean defaultValue,
String... keys) {
+ configSource = guardConfigSource(configSource);
if (configSource == null) {
- configSource = (Configuration)
DynamicPropertyFactory.getBackingConfigurationSource();
+ return defaultValue;
}
for (String key : keys) {
Boolean val = configSource.getBoolean(key, null);
@@ -151,4 +154,11 @@ private static boolean getBooleanProperty(Configuration
configSource, boolean de
}
return defaultValue;
}
+
+ private static Configuration guardConfigSource(Configuration configSource) {
+ if (configSource == null &&
DynamicPropertyFactory.getBackingConfigurationSource() != null) {
+ configSource = (Configuration)
DynamicPropertyFactory.getBackingConfigurationSource();
+ }
+ return configSource;
+ }
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services