diff options
author | Murali Mohan Murthy Potham <murali.p@huawei.com> | 2017-09-26 11:18:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-26 11:18:29 +0000 |
commit | eaf31108b2f28ed6d14ca6b237837e24a38fb628 (patch) | |
tree | 28948afa6dc5778958e9be0ec2780f231d19d36b /vnfmarket-be | |
parent | 250f9524972b57446c9dc7a662d5f84b8b2a78a2 (diff) | |
parent | 15230b1e32b5f67ee615c41a1d237f0ab80243dc (diff) |
Merge "replace while with for"
Diffstat (limited to 'vnfmarket-be')
-rw-r--r-- | vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/ToolUtil.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/ToolUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/ToolUtil.java index 432ee219..e45d31bf 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/ToolUtil.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/http/ToolUtil.java @@ -83,8 +83,12 @@ public class ToolUtil { } File destDir = new File(useDestDirName); if (destDir.exists() && overlay) { - new File(destDirName).delete(); - } else if ((destDir.exists() && !overlay) || (!destDir.exists() && !destDir.mkdirs())) { + new File(useDestDirName).delete(); + } else if (destDir.exists() && !overlay) { + return false; + } + + if (!destDir.mkdirs()) { return false; } @@ -107,11 +111,11 @@ public class ToolUtil { ) { byte[] buffer = new byte[1024]; - int byteread = 0; - while ((byteread = in.read(buffer)) != -1) { + for (int byteread = 0; (byteread = in.read(buffer)) != -1;) { out.write(buffer, 0, byteread); } + return true; } catch (IOException e) { LOGGER.error("IOException in copyFile", e); |