Merge "Update the logic for MSB addr Query"
authortang peng <tang.peng5@zte.com.cn>
Tue, 31 Oct 2017 04:37:36 +0000 (04:37 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 31 Oct 2017 04:37:36 +0000 (04:37 +0000)
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);