[GitHub] liubao68 commented on a change in pull request #767: [SCB-662]Using cse/servicecomb duplicate key will get list of values

2018-06-14 Thread GitBox
liubao68 commented on a change in pull request #767: [SCB-662]Using 
cse/servicecomb duplicate key will get list of values
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/767#discussion_r195408761
 
 

 ##
 File path: 
foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 ##
 @@ -171,7 +171,14 @@ private static void 
duplicateServiceCombConfigToCse(AbstractConfiguration source
   }
 
   String cseKey = CONFIG_CSE_PREFIX + key.substring(key.indexOf(".") + 1);
-  source.addProperty(cseKey, source.getProperty(key));
+  if (!source.containsKey(cseKey)) {
+source.addProperty(cseKey, source.getProperty(key));
 
 Review comment:
   source.setProperty will clear and add. Here we checked existence and logged 
a warning message. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] liubao68 commented on a change in pull request #767: [SCB-662]Using cse/servicecomb duplicate key will get list of values

2018-06-14 Thread GitBox
liubao68 commented on a change in pull request #767: [SCB-662]Using 
cse/servicecomb duplicate key will get list of values
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/767#discussion_r195391079
 
 

 ##
 File path: 
foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 ##
 @@ -171,7 +171,14 @@ private static void 
duplicateServiceCombConfigToCse(AbstractConfiguration source
   }
 
   String cseKey = CONFIG_CSE_PREFIX + key.substring(key.indexOf(".") + 1);
-  source.addProperty(cseKey, source.getProperty(key));
+  if (!source.containsKey(cseKey)) {
+source.addProperty(cseKey, source.getProperty(key));
+  } else {
+LOGGER
+.warn(
 
 Review comment:
   "stop working" can not be applied because we may configure some default 
values using cse or servicecomb, if doing this users code have to change to 
work properly. We can't do this now.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] liubao68 commented on a change in pull request #767: [SCB-662]Using cse/servicecomb duplicate key will get list of values

2018-06-13 Thread GitBox
liubao68 commented on a change in pull request #767: [SCB-662]Using 
cse/servicecomb duplicate key will get list of values
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/767#discussion_r194969232
 
 

 ##
 File path: 
foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigUtil.java
 ##
 @@ -171,7 +171,14 @@ private static void 
duplicateServiceCombConfigToCse(AbstractConfiguration source
   }
 
   String cseKey = CONFIG_CSE_PREFIX + key.substring(key.indexOf(".") + 1);
-  source.addProperty(cseKey, source.getProperty(key));
+  if (!source.containsKey(cseKey)) {
+source.addProperty(cseKey, source.getProperty(key));
+  } else {
+LOGGER
+.warn(
 
 Review comment:
   As shown in test case, this can work. Just when merge, it will not take the 
cse-config-order(which is implemented by file configuration source). We can not 
cover all orders for Configuration sources like enviroment, properties, dynamic 
config and so on, so give a warning  message. 


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:
us...@infra.apache.org


With regards,
Apache Git Services