liubao68 commented on a change in pull request #2268:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/2268#discussion_r589146175



##########
File path: 
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
##########
@@ -147,5 +160,18 @@ public void handle(String action, Map<String, Object> 
parseConfigs) {
       }
       LOGGER.info("Config value cache changed: action:{}; item:{}", action, 
configuration.keySet());
     }
+
+    private void replaceConfig(Map<String, Object> configuration, String 
fileName) {
+      Object tempConfig = configuration.get(fileName);
+      configuration.remove(fileName);
+      try {
+        Map<String, Object> properties = YAMLUtil.yaml2Properties(
+          new ByteArrayInputStream(tempConfig.toString().replaceAll(":", ": 
").getBytes()));
+        configuration.putAll(properties);
+      } catch (ClassCastException e) {
+        LOGGER.warn("yaml file has incorrect format");
+        e.printStackTrace();

Review comment:
       1. remove `e.printStackTrace();`, using `LOGGER.warn("yaml file has 
incorrect format", e);`
   2. when will `ClassCastException` thrown? seems this catch statement will 
never happen. 
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to