From 43cd454e7eb4e061cf79d84a9eda1b393a59edca Mon Sep 17 00:00:00 2001
From: Amaresh Kumar <kamaresh@in.ibm.com>
Date: Fri, 7 Sep 2018 15:04:21 +0530
Subject: Fixed blocker issue in DMaaPResponseBuilder.java

https://sonar.onap.org/project/issues?id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AWU41WfQwGn37JfbyHsq&resolved=false&severities=BLOCKER&types=BUG

Issue-ID: DMAAP-748
Change-Id: Ie21e69a8ff69aab20dcbd1ec0f6db947db55271a
Signed-off-by: Amaresh Kumar <kamaresh@in.ibm.com>
---
 src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java b/src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java
index 4c38d57..c9a998b 100644
--- a/src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java
+++ b/src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java
@@ -130,10 +130,10 @@ public class DMaaPResponseBuilder {
 	 */
 	public static void respondOkWithStream(DMaaPContext ctx, String mediaType, StreamWriter writer) throws IOException {
 		ctx.getResponse().setStatus(200);
-		OutputStream os = getStreamForBinaryResponse(ctx, mediaType);
-		writer.write(os);
-		os.close();
-		
+		try(OutputStream os = getStreamForBinaryResponse(ctx, mediaType)) {
+			writer.write(os);
+		}
+
 		
 	}
 
-- 
cgit 1.2.3-korg