From 874e6b5e33b3e0bf7a362d591467cd80ba7e5b6e Mon Sep 17 00:00:00 2001 From: elinuxhenrik Date: Tue, 2 Oct 2018 17:31:50 +0200 Subject: Fix bug in DataRouter file body Change-Id: Ia3f868c272ebc426b6a694074dbd2a4a2cb7ae32 Issue-ID: DCAEGEN2-850 Signed-off-by: elinuxhenrik --- .../service/producer/DmaapProducerReactiveHttpClient.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'datafile-dmaap-client/src/main/java') diff --git a/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java b/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java index fae86a82..5cd9056d 100644 --- a/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java +++ b/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java @@ -99,7 +99,8 @@ public class DmaapProducerReactiveHttpClient { addUserCredentialsToHead(headers); - HttpEntity request = addFileToRequest(consumerDmaapModel, headers); + InputStream fileInputStream = getInputStream(consumerDmaapModel.getLocation()); + HttpEntity request = addFileToRequest(fileInputStream, headers); logger.trace("Starting to publish to DR"); @@ -129,10 +130,9 @@ public class DmaapProducerReactiveHttpClient { headers.set(X_ATT_DR_META, metaData.toString()); } - private HttpEntity addFileToRequest(ConsumerDmaapModel consumerDmaapModel, HttpHeaders headers) + private HttpEntity addFileToRequest(InputStream inputStream, HttpHeaders headers) throws IOException { - InputStream in = getInputStream(consumerDmaapModel.getLocation()); - return new HttpEntity<>(IOUtils.toByteArray(in), headers); + return new HttpEntity<>(IOUtils.toByteArray(inputStream), headers); } private InputStream getInputStream(String filePath) throws IOException { -- cgit 1.2.3-korg