diff options
author | wasala <przemyslaw.wasala@nokia.com> | 2018-05-23 08:27:44 +0200 |
---|---|---|
committer | wasala <przemyslaw.wasala@nokia.com> | 2018-05-23 08:27:44 +0200 |
commit | e6f50c671627adc43e3aeeb3f3656dc8dfc584dd (patch) | |
tree | e3baa744929a06c06bd87cfcbdf4da6f6eba6a5d /prh-dmaap-client/src | |
parent | 3c19249a6c94005ff8d55c52a5274c8e65d95dd1 (diff) |
Deleted NullPointerException
Add logging about
status code in DmaapProducer
Change-Id: If1e8398cabbee3f0f51fcb007ef02049a7a85c00
Issue-ID: DCAEGEN2-396
Signed-off-by: wasala <przemyslaw.wasala@nokia.com>
Diffstat (limited to 'prh-dmaap-client/src')
2 files changed, 14 insertions, 13 deletions
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java index 3bae6989..8d2f82d9 100644 --- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java +++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/ExtendedDmaapConsumerHttpClientImpl.java @@ -68,7 +68,7 @@ public class ExtendedDmaapConsumerHttpClientImpl { try { return createRequest() .flatMap(this::executeHttpClient); - } catch (NullPointerException | URISyntaxException e) { + } catch (URISyntaxException e) { logger.warn("Exception while executing HTTP request: ", e); } return Optional.empty(); diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/ExtendedDmaapProducerHttpClientImpl.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/ExtendedDmaapProducerHttpClientImpl.java index bea36201..2f96b396 100644 --- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/ExtendedDmaapProducerHttpClientImpl.java +++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/ExtendedDmaapProducerHttpClientImpl.java @@ -68,7 +68,7 @@ public class ExtendedDmaapProducerHttpClientImpl { try { return createRequest() .flatMap(this::executeHttpClient); - } catch (NullPointerException | URISyntaxException e) { + } catch (URISyntaxException e) { logger.warn("Exception while executing HTTP request: ", e); } return Optional.empty(); @@ -114,16 +114,17 @@ public class ExtendedDmaapProducerHttpClientImpl { } private Optional<String> getDmaapProducerResponseHandler(HttpResponse httpResponse) throws IOException { - final int responseCode = httpResponse.getStatusLine().getStatusCode(); - final HttpEntity responseEntity = httpResponse.getEntity(); + final int responseCode = httpResponse.getStatusLine().getStatusCode(); + logger.info("Status code of operation: {}", responseCode); + final HttpEntity responseEntity = httpResponse.getEntity(); - if (HttpUtils.isSuccessfulResponseCode(responseCode)) { - logger.trace("HTTP response successful."); - return Optional.of("" + responseCode); - } else { - String response = responseEntity != null ? EntityUtils.toString(responseEntity) : ""; - logger.warn("HTTP response not successful : {}", response); - return Optional.of("" + responseCode); - } + if (HttpUtils.isSuccessfulResponseCode(responseCode)) { + logger.trace("HTTP response successful."); + return Optional.of("" + responseCode); + } else { + String response = responseEntity != null ? EntityUtils.toString(responseEntity) : ""; + logger.warn("HTTP response not successful : {}", response); + return Optional.of("" + responseCode); + } } -} +}
\ No newline at end of file |