Update the logic for MSB addr Query 09/21409/1
authorGuangrong Fu <fu.guangrong@zte.com.cn>
Tue, 31 Oct 2017 04:20:33 +0000 (12:20 +0800)
committerGuangrong Fu <fu.guangrong@zte.com.cn>
Tue, 31 Oct 2017 04:20:33 +0000 (12:20 +0800)
Change-Id: I2e7bcd48e04b7ec54573d3eb2dbb9b525e25c3b6
Issue-ID: HOLMES-81
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java
holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationQuery.java

index 212bc66..d86f56c 100644 (file)
@@ -98,10 +98,15 @@ public class MicroServiceConfig {
         //String info = getServiceAddrInfoFromCBS(MSB_ADDR);\r
         String info = getServiceAddrInfoFromCBS(getEnv(HOSTNAME));\r
         log.info("Got the service information of \"" + getEnv(HOSTNAME) + "\" from CBS. The response is " + info + ".");\r
-        JSONObject infoObj = JSONObject.fromObject(info);\r
-        info = infoObj.has("msb.hostname") ? infoObj.getString("msb.hostname") : null;\r
+\r
         if (info != null){\r
-            msbServerInfo = split(info);\r
+            JSONObject infoObj = JSONObject.fromObject(info);\r
+            String msbInfoTmp = infoObj.has("msb.hostname") ? infoObj.getString("msb.hostname") : null;\r
+            if (msbInfoTmp != null) {\r
+                msbServerInfo = split(msbInfoTmp);\r
+            } else {\r
+                msbServerInfo = split(getEnv(MSB_ADDR));\r
+            }\r
         } else {\r
             msbServerInfo = split(getEnv(MSB_ADDR));\r
         }\r
index 8dd3690..897f689 100644 (file)
@@ -34,7 +34,7 @@ public class DcaeConfigurationQuery {
         try {
             response = getDcaeResponse(serviceAddrInfo);
         } catch (Exception e) {
-            throw new CorrelationException("Failed to connect to dcae", e);
+            throw new CorrelationException("Failed to connect to DCAE. ", e);
         }
         DcaeConfigurations dcaeConfigurations = null;
         dcaeConfigurations = DcaeConfigurationParser.parse(response);