summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaresh Kumar <kamaresh@in.ibm.com>2018-09-07 15:04:21 +0530
committerAmaresh Kumar <kamaresh@in.ibm.com>2018-09-07 15:05:37 +0530
commit43cd454e7eb4e061cf79d84a9eda1b393a59edca (patch)
tree1ace3f0fc230d467c7da1f50040d5d8fc1f0ba60
parentb9862c6303212a98e18da3112c422a1cf4251ebf (diff)
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>
-rw-r--r--src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java8
1 files changed, 4 insertions, 4 deletions
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);
+ }
+
}