summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-09-20 11:45:40 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2017-09-20 12:00:25 +0800
commit1c03192977cf0eb18c3b595711c4d47f91077568 (patch)
treec245d371088a0c10f309b4913868fb7a414fe4aa
parent43148fa4eba15d92623455379e06beba46d9c4e1 (diff)
refactor unzip in FileUtil
major: L124 L128 L129 Change-Id: Ib1e2379596b64784112a0a0d591c05a4d2df3e82 Signed-off-by: Harry Huang <huangxiangyu5@huawei.com> Issue-Id: VNFSDK-85
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java7
1 files changed, 2 insertions, 5 deletions
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());