From f4d85387b5e7a5d6699f4f24a25cd5bcba558211 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Sat, 23 Sep 2017 17:15:42 +0800 Subject: use for loop instead of while major: L311 Change-Id: I6ed9c0a2794353610d751cbe8d1bc535db3a29a3 Signed-off-by: Harry Huang Issue-Id: VNFSDK-85 --- .../marketplace/wrapper/PackageWrapperUtil.java | 43 +++++++++++----------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/main') 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(); -- cgit 1.2.3-korg