From ed36c288214bee313f2252148ce1dd783b32b543 Mon Sep 17 00:00:00 2001 From: Murali-P Date: Wed, 15 Feb 2017 19:11:32 +0530 Subject: Fix Sonar Issues Resolved:VNFSDK-21 VNF SDK Function test Change-Id: I5e235238815b43c1ffe12d37a09215ec740f016f Signed-off-by: Murali-P --- .../java/org/openo/vnfsdk/functest/resource/CommonManager.java | 4 +--- .../main/java/org/openo/vnfsdk/functest/util/ZipCompressor.java | 9 +++++---- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'vnf-sdk-function-test/src/main/java') diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java index 3fef44e..41c4391 100644 --- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java +++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java @@ -101,9 +101,7 @@ public class CommonManager { }); // Send REST response - Response response = RestResponseUtil.getSuccessResponse(uniqueKey); - - return response; + return RestResponseUtil.getSuccessResponse(uniqueKey); } catch(IOException e) { LOGGER.error("Upload the script and execute the script and run command", e); diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/util/ZipCompressor.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/util/ZipCompressor.java index 02a0609..0ab292c 100644 --- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/util/ZipCompressor.java +++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/util/ZipCompressor.java @@ -90,9 +90,10 @@ public class ZipCompressor { if(!file.exists()) { return; } - try { + try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) { + byte data[] = new byte[BUFFER]; - BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); + ZipEntry entry = new ZipEntry(basedir + file.getName()); out.putNextEntry(entry); int count; @@ -100,8 +101,8 @@ public class ZipCompressor { out.write(data, 0, count); } bis.close(); - } catch(Exception e1) { - throw new RuntimeException(e1); + } catch(IOException e) { + LOG.info("Exception wile compress file" + file.getAbsolutePath(), e); } } } -- cgit 1.2.3-korg