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>
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 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);
+		}
+
 		
 	}