diff options
author | Steve Smokowski <ss835w@att.com> | 2018-12-17 14:46:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-12-17 14:46:00 +0000 |
commit | 47e83f7ba26e8d05f4d4ba9ac8281a7ab16a77c9 (patch) | |
tree | e782f6bb91a0f6bb8ff62f9cef6869603617b15a | |
parent | edecd1cc4256cab1b7af086baeaa6ef79e72f281 (diff) | |
parent | a18c1354055e54c5d9d9b7bdc7cf8542175e7622 (diff) |
Merge "Use try-with-resources : Sonar:Blocker"
-rw-r--r-- | asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java | 11 |
1 files changed, 8 insertions, 3 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 e4a4c7cdfb..486844ae02 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 @@ -158,14 +158,19 @@ public class BpmnInstaller { return requestEntity; } - protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) throws IOException { + /* protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) throws IOException */ + protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) { String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", fileName).normalize().toString(); - BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath)); + /* BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath)); */ + try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath))){ byte[] bytesIn = new byte[4096]; int read = 0; while ((read = zipIn.read(bytesIn)) != -1) { outputStream.write(bytesIn, 0, read); } - outputStream.close(); + /* outputStream.close(); */ + } catch (IOException e) { + LOGGER.error("Unable to open file.", e); + } } } |