summaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main/java
diff options
context:
space:
mode:
authork.kazak <k.kazak@samsung.com>2019-08-14 10:18:31 +0200
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-08-19 10:52:19 +0000
commit81f26b4c1837c9f8ff49619782fe01d99f4f0683 (patch)
treed845ed5c21e2c55545320bd39b7157a27e60e241 /asdc-controller/src/main/java
parent5b17afb416e3ab2d3f58694d275e67f20af5a1c6 (diff)
Close input streams via try-with-resources
DefaultDmaapPropertiesImpl: close FileInputStream after loading ServicePluginFactory: close HttpClient if processing fails close application.properties InputStream after loading remove redundant catch block if behavior is the same add logging of exception in finally block BpmnInstaller: close csarFile if processing fails Change-Id: Ic6f942c401277c5150c5cc1297aba27ccd40694c Coverity-scan: CID-203903, CID-211476, CID-211615, CID-219308 Issue-ID: SO-2211 Signed-off-by: k.kazak <k.kazak@samsung.com>
Diffstat (limited to 'asdc-controller/src/main/java')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
index 095741c19b..195aa7e302 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -33,7 +33,6 @@ import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
-import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
@@ -49,6 +48,7 @@ import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.HttpClientBuilder;
import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -71,9 +71,8 @@ public class BpmnInstaller {
public void installBpmn(String csarFilePath) {
logger.info("Deploying BPMN files from {}", csarFilePath);
- try {
- ZipInputStream csarFile =
- new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()));
+ try (ZipInputStream csarFile =
+ new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()))) {
ZipEntry entry = csarFile.getNextEntry();
while (entry != null) {
@@ -103,7 +102,6 @@ public class BpmnInstaller {
}
entry = csarFile.getNextEntry();
}
- csarFile.close();
} catch (IOException ex) {
logger.debug("Exception :", ex);
logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,