You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2018/04/03 05:19:40 UTC
[incubator-skywalking] branch fix/reverse-system.env updated:
Override value only in supported types. Int, String, Long, Boolean.
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch fix/reverse-system.env
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git
The following commit(s) were added to refs/heads/fix/reverse-system.env by this push:
new a222217 Override value only in supported types. Int, String, Long, Boolean.
a222217 is described below
commit a222217486adfe43bd0e212b1b7085a3ed228d6b
Author: wu-sheng <wu...@foxmail.com>
AuthorDate: Tue Apr 3 13:19:12 2018 +0800
Override value only in supported types. Int, String, Long, Boolean.
---
.../collector/boot/config/ApplicationConfigLoader.java | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/apm-collector/apm-collector-boot/src/main/java/org/apache/skywalking/apm/collector/boot/config/ApplicationConfigLoader.java b/apm-collector/apm-collector-boot/src/main/java/org/apache/skywalking/apm/collector/boot/config/ApplicationConfigLoader.java
index 5b2274e..a6d6a18 100644
--- a/apm-collector/apm-collector-boot/src/main/java/org/apache/skywalking/apm/collector/boot/config/ApplicationConfigLoader.java
+++ b/apm-collector/apm-collector-boot/src/main/java/org/apache/skywalking/apm/collector/boot/config/ApplicationConfigLoader.java
@@ -133,7 +133,23 @@ public class ApplicationConfigLoader implements ConfigLoader<ApplicationConfigur
return;
}
Properties providerSettings = moduleConfiguration.getProviderConfiguration(providerName);
- providerSettings.put(settingKey, value);
+ if (!providerSettings.containsKey(settingKey)) {
+ return;
+ }
+ Object originValue = providerSettings.get(settingKey);
+ Class<?> type = originValue.getClass();
+ if (type.equals(int.class) || type.equals(Integer.class))
+ providerSettings.put(settingKey, Integer.valueOf(value));
+ else if (type.equals(String.class))
+ providerSettings.put(settingKey, value);
+ else if (type.equals(long.class) || type.equals(Long.class))
+ providerSettings.put(settingKey, Long.valueOf(value));
+ else if (type.equals(boolean.class) || type.equals(Boolean.class)) {
+ providerSettings.put(settingKey, Boolean.valueOf(value));
+ } else {
+ return;
+ }
+
logger.info("The setting has been override by key: {}, value: {}, in {} provider of {} module through {}",
settingKey, value, providerName, moduleName, isSystemProperty ? "System.properties" : "System.envs");
}
--
To stop receiving notification emails like this one, please contact
wusheng@apache.org.