summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMurali-P <murali.p@huawei.com>2017-02-15 19:11:32 +0530
committerMurali-P <murali.p@huawei.com>2017-02-15 19:11:32 +0530
commited36c288214bee313f2252148ce1dd783b32b543 (patch)
tree01cb3a15399c82516d69f6da0c6c865bbdd38595
parent0b0e6623b173dc97bd62fe9d5d41066362cc8464 (diff)
Fix Sonar Issues
Resolved:VNFSDK-21 VNF SDK Function test Change-Id: I5e235238815b43c1ffe12d37a09215ec740f016f Signed-off-by: Murali-P <murali.p@huawei.com>
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java4
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/util/ZipCompressor.java9
2 files changed, 6 insertions, 7 deletions
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);
}
}
}