diff options
Diffstat (limited to 'datafile-dmaap-client/src/main')
-rw-r--r-- | datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClient.java | 8 |
1 files changed, 4 insertions, 4 deletions
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<byte[]> request = addFileToRequest(consumerDmaapModel, headers); + InputStream fileInputStream = getInputStream(consumerDmaapModel.getLocation()); + HttpEntity<byte[]> 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<byte[]> addFileToRequest(ConsumerDmaapModel consumerDmaapModel, HttpHeaders headers) + private HttpEntity<byte[]> 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 { |