diff options
Diffstat (limited to 'holmes-actions/src/main/java')
-rw-r--r-- | holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationQuery.java | 7 | ||||
-rw-r--r-- | holmes-actions/src/main/java/org/onap/holmes/common/dmaap/Publisher.java | 9 |
2 files changed, 13 insertions, 3 deletions
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 1576215..8dd3690 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 @@ -30,7 +30,12 @@ public class DcaeConfigurationQuery { public static DcaeConfigurations getDcaeConfigurations(String hostname) throws CorrelationException { String serviceAddrInfo = MicroServiceConfig.getServiceAddrInfoFromCBS(hostname); - String response = getDcaeResponse(serviceAddrInfo); + String response; + try { + response = getDcaeResponse(serviceAddrInfo); + } catch (Exception e) { + throw new CorrelationException("Failed to connect to dcae", e); + } DcaeConfigurations dcaeConfigurations = null; dcaeConfigurations = DcaeConfigurationParser.parse(response); return dcaeConfigurations; diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/Publisher.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/Publisher.java index 285c3d6..0f96181 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/Publisher.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/Publisher.java @@ -52,8 +52,13 @@ public class Publisher { e);
}
WebTarget webTarget = client.target(url);
- Response response = webTarget.request(MediaType.APPLICATION_JSON)
- .post(Entity.entity(content, MediaType.APPLICATION_JSON));
+ Response response = null;
+ try {
+ response = webTarget.request(MediaType.APPLICATION_JSON)
+ .post(Entity.entity(content, MediaType.APPLICATION_JSON));
+ } catch (Exception e) {
+ throw new CorrelationException("Failed to connect dcae.", e);
+ }
return checkStatus(response);
}
|