summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();
}
a> 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152