refactor unzip in FileUtil 53/13653/1
authorHarry Huang <huangxiangyu5@huawei.com>
Wed, 20 Sep 2017 03:45:40 +0000 (11:45 +0800)
committerHarry Huang <huangxiangyu5@huawei.com>
Wed, 20 Sep 2017 04:00:25 +0000 (12:00 +0800)
major: L124 L128 L129

Change-Id: Ib1e2379596b64784112a0a0d591c05a4d2df3e82
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Issue-Id: VNFSDK-85

vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java

index 87fb75b..642fc8f 100644 (file)
@@ -125,11 +125,8 @@ public final class FileUtil {
                     InputStream input = zipFile.getInputStream(entry);
                     BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
                 ) {
-                    while (true) {
-                        int length = input.read(buffer);
-                        if (length == -1) {
-                            break;
-                        }
+                    int length = 0;
+                    while ((length = input.read(buffer)) != -1) {
                         bos.write(buffer, 0, length);
                     }
                     unzipFileNams.add(file.getAbsolutePath());