From 1c03192977cf0eb18c3b595711c4d47f91077568 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Wed, 20 Sep 2017 11:45:40 +0800 Subject: refactor unzip in FileUtil major: L124 L128 L129 Change-Id: Ib1e2379596b64784112a0a0d591c05a4d2df3e82 Signed-off-by: Harry Huang Issue-Id: VNFSDK-85 --- .../src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/main/java/org') diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java index 87fb75b6..642fc8f0 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java @@ -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()); -- cgit 1.2.3-korg