use for loop instead of while 33/14833/1
authorHarry Huang <huangxiangyu5@huawei.com>
Sat, 23 Sep 2017 09:15:42 +0000 (17:15 +0800)
committerHarry Huang <huangxiangyu5@huawei.com>
Sat, 23 Sep 2017 09:16:23 +0000 (17:16 +0800)
major: L311

Change-Id: I6ed9c0a2794353610d751cbe8d1bc535db3a29a3
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Issue-Id: VNFSDK-85

vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java

index cddb4c4..1777c1e 100644 (file)
@@ -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();