summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/main
diff options
context:
space:
mode:
authorAvinashS <avinash.s@huawei.com>2017-09-20 18:35:25 +0530
committerAvinashS <avinash.s@huawei.com>2017-09-20 18:35:25 +0530
commit5fd55c6e90731995a7d8c19f63d30ee8a6abb415 (patch)
tree2fa3eb95c271141e58f94b39eb12fb52f08374a9 /csarvalidation/src/main
parentce2b1e181d2ef074d4f12eeec4342c4020273327 (diff)
Fix run time and static error findings
Change-Id: I9caee424003a522f25227c098588e9b77b4b6bdb IssueId: VNFSDK-94 Signed-off-by: AvinashS <avinash.s@huawei.com>
Diffstat (limited to 'csarvalidation/src/main')
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/csar/CsarUtil.java11
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/csar/FileUtil.java3
2 files changed, 4 insertions, 10 deletions
diff --git a/csarvalidation/src/main/java/org/onap/validation/csar/CsarUtil.java b/csarvalidation/src/main/java/org/onap/validation/csar/CsarUtil.java
index ee0110c..4367f0d 100644
--- a/csarvalidation/src/main/java/org/onap/validation/csar/CsarUtil.java
+++ b/csarvalidation/src/main/java/org/onap/validation/csar/CsarUtil.java
@@ -41,8 +41,6 @@ import java.util.zip.ZipFile;
public class CsarUtil {
private static final Logger logger = LoggerFactory.getLogger(CsarUtil.class);
-
-
public static String getUnzipDir(String dirName) {
File tmpDir = new File(File.separator + dirName);
@@ -61,11 +59,10 @@ public class CsarUtil {
* e1
*/
public static HashMap<String, String> unzip(String zipFileName, String extPlace) throws IOException {
- ZipFile zipFile = null;
- HashMap<String, String> unzipFileNames = new HashMap<String, String>();
+ HashMap<String, String> unzipFileNames = new HashMap<>();
+
+ try(ZipFile zipFile = new ZipFile(zipFileName)) {
- try {
- zipFile = new ZipFile(zipFileName);
Enumeration<?> fileEn = zipFile.entries();
byte[] buffer = new byte[CommonConstants.BUFFER_SIZE];
@@ -98,8 +95,6 @@ public class CsarUtil {
closeInputStream(input);
}
}
- } finally {
- FileUtil.closeZipFile(zipFile);
}
return unzipFileNames;
}
diff --git a/csarvalidation/src/main/java/org/onap/validation/csar/FileUtil.java b/csarvalidation/src/main/java/org/onap/validation/csar/FileUtil.java
index 82f6ff4..d3cfd0a 100644
--- a/csarvalidation/src/main/java/org/onap/validation/csar/FileUtil.java
+++ b/csarvalidation/src/main/java/org/onap/validation/csar/FileUtil.java
@@ -141,8 +141,7 @@ public final class FileUtil {
try {
if (zipFile != null) {
zipFile.close();
- zipFile = null;
- }
+ }
} catch (IOException e1) {
logger.info("close ZipFile error!");
}