diff options
author | 2019-09-10 15:44:55 +0800 | |
---|---|---|
committer | 2019-10-14 06:51:59 +0000 | |
commit | 51041bd80a870aad7bc3ad135e28221d5445b25d (patch) | |
tree | 3e993cd13342f66ebd1690d62c8fb3e970b8979d /vnfmarket-be/vnf-sdk-marketplace/src/main | |
parent | 7f232e125dbe030f0bf3c360865cba832b694404 (diff) |
modify Sonar Issue
Issue-ID: VNFSDK-462
Signed-off-by: Hailong Zhang <zhanghailong22@huawei.com>
Change-Id: I39216599b2a1f06297b89e86a84c84761a9437b4
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/main')
-rw-r--r-- | vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java | 12 |
1 files changed, 2 insertions, 10 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 a080cb03..ce6ae72e 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 @@ -46,8 +46,6 @@ public final class FileUtil { private static final int MAX_PACKAGE_SIZE = 50 * 1024 * 1024; - private static final int TRY_COUNT = 3; - private FileUtil() { //Empty constructor } @@ -61,17 +59,11 @@ public final class FileUtil { */ public static boolean createDirectory(String dir) { File folder = new File(dir); - int tryCount = 0; - while (tryCount < TRY_COUNT) { - tryCount++; if (!folder.exists() && !folder.mkdirs()) { - continue; + return false; } else { return true; } - } - - return folder.exists(); } /** @@ -128,7 +120,7 @@ public final class FileUtil { } try (InputStream input = zipFile.getInputStream(entry); - BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));) { + BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));) { int length = 0; while ((length = input.read(buffer)) != -1) { bos.write(buffer, 0, length); |