From b81ab90bdc2cd6aeebe9b07516a9cb513749d7cd Mon Sep 17 00:00:00 2001 From: Guangrong Fu Date: Tue, 31 Oct 2017 12:20:33 +0800 Subject: Update the logic for MSB addr Query Change-Id: I2e7bcd48e04b7ec54573d3eb2dbb9b525e25c3b6 Issue-ID: HOLMES-81 Signed-off-by: Guangrong Fu --- .../org/onap/holmes/common/config/MicroServiceConfig.java | 11 ++++++++--- .../org/onap/holmes/common/dcae/DcaeConfigurationQuery.java | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'holmes-actions') diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java index 212bc66..d86f56c 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java @@ -98,10 +98,15 @@ public class MicroServiceConfig { //String info = getServiceAddrInfoFromCBS(MSB_ADDR); String info = getServiceAddrInfoFromCBS(getEnv(HOSTNAME)); log.info("Got the service information of \"" + getEnv(HOSTNAME) + "\" from CBS. The response is " + info + "."); - JSONObject infoObj = JSONObject.fromObject(info); - info = infoObj.has("msb.hostname") ? infoObj.getString("msb.hostname") : null; + if (info != null){ - msbServerInfo = split(info); + JSONObject infoObj = JSONObject.fromObject(info); + String msbInfoTmp = infoObj.has("msb.hostname") ? infoObj.getString("msb.hostname") : null; + if (msbInfoTmp != null) { + msbServerInfo = split(msbInfoTmp); + } else { + msbServerInfo = split(getEnv(MSB_ADDR)); + } } else { msbServerInfo = split(getEnv(MSB_ADDR)); } diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationQuery.java b/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationQuery.java index 8dd3690..897f689 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationQuery.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationQuery.java @@ -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); -- cgit 1.2.3-korg