diff options
author | Harry Huang <huangxiangyu5@huawei.com> | 2017-09-23 17:15:42 +0800 |
---|---|---|
committer | Harry Huang <huangxiangyu5@huawei.com> | 2017-09-23 17:16:23 +0800 |
commit | f4d85387b5e7a5d6699f4f24a25cd5bcba558211 (patch) | |
tree | 0f98200e52cb96ad01e8b6d88310e34cd9207cfd /vnfmarket-be | |
parent | 3ba9e52591b9bc295c2e7b3721cd7123c399f534 (diff) |
use for loop instead of while
major: L311
Change-Id: I6ed9c0a2794353610d751cbe8d1bc535db3a29a3
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Issue-Id: VNFSDK-85
Diffstat (limited to 'vnfmarket-be')
-rw-r--r-- | vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java index cddb4c4e..1777c1ec 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java @@ -308,28 +308,27 @@ public class PackageWrapperUtil { File file = new File(unzipFile); try (BufferedReader reader = new BufferedReader(new FileReader(file))) { - String tempString = null; - while ((tempString = reader.readLine()) != null) { - - // If line is empty, ignore - if ("".equals(tempString)) { - continue; - } - - int count1 = tempString.indexOf(":"); - String meta = tempString.substring(0, count1).trim(); - - // Check for the package provider name - if (meta.equalsIgnoreCase(CommonConstant.MF_PROVIDER_META)) { - int count = tempString.indexOf(":") + 1; - basicInfo.setProvider(tempString.substring(count).trim()); - } - - // Check for package version - if (meta.equalsIgnoreCase(CommonConstant.MF_VERSION_META)) { - int count = tempString.indexOf(":") + 1; - basicInfo.setVersion(tempString.substring(count).trim()); - } + for(String tempString = null; (tempString = reader.readLine()) != null;) + { + // If line is empty, ignore + if ("".equals(tempString)) { + continue; + } + + int count1 = tempString.indexOf(":"); + String meta = tempString.substring(0, count1).trim(); + + // Check for the package provider name + if (meta.equalsIgnoreCase(CommonConstant.MF_PROVIDER_META)) { + int count = tempString.indexOf(":") + 1; + basicInfo.setProvider(tempString.substring(count).trim()); + } + + // Check for package version + if (meta.equalsIgnoreCase(CommonConstant.MF_VERSION_META)) { + int count = tempString.indexOf(":") + 1; + basicInfo.setVersion(tempString.substring(count).trim()); + } } reader.close(); |