summaryrefslogtreecommitdiffstats
path: root/common-app-api/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'common-app-api/src/main/java')
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java
index 386a66bafe..c9207b2f42 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java
@@ -128,13 +128,14 @@ public class ZipUtil {
public static byte[] zipBytes(byte[] input) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ZipOutputStream zos = new ZipOutputStream(baos);
- ZipEntry entry = new ZipEntry("zip");
- entry.setSize(input.length);
- zos.putNextEntry(entry);
- zos.write(input);
- zos.closeEntry();
- zos.close();
+ try (ZipOutputStream zos = new ZipOutputStream(baos)) {
+ ZipEntry entry = new ZipEntry("zip");
+ entry.setSize(input.length);
+ zos.putNextEntry(entry);
+ zos.write(input);
+ zos.closeEntry();
+ zos.close();
+ }
return baos.toByteArray();
}