diff options
author | Shiwei Tian <tian.shiwei@zte.com.cn> | 2017-10-16 10:51:51 +0800 |
---|---|---|
committer | Shiwei Tian <tian.shiwei@zte.com.cn> | 2017-10-16 10:51:51 +0800 |
commit | 6c9ff5b3edcb451bb61ff2180e30f79339434d1f (patch) | |
tree | 16641125179708f3725ed891ebf0e5d7dec3db3d /holmes-actions/src/main/java | |
parent | cea973bd4b6c2e13db5600ac2504b2abab596a21 (diff) |
modify http request bug
Issue-ID: HOLMES-71
Change-Id: I733adbe08e2c237dddb9362c90c368142ec17627
Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
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);
}
|