summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-07-16 17:55:58 +0000
committerGerrit Code Review <gerrit@onap.org>2018-07-16 17:55:58 +0000
commit6a10ebebb37fd09492aa0fe4a5e05db68d078ac8 (patch)
tree3fb6e0d34a92276f420c36f170fdb4fff61e39a5
parentf53cadde4bd889e1b33df14c1aa4de76ced2b82f (diff)
parent615725b3dea2275b00d07be9aecbfbb320001ef0 (diff)
Merge "Fix potential errors in ASDCController"
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
index c452089425..867efd5840 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
@@ -492,17 +492,17 @@ public class ASDCController {
try {
LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName());
- FileOutputStream outFile = new FileOutputStream(System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactName());
- outFile.write(payloadBytes, 0, payloadBytes.length);
- outFile.close();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- artifact.getArtifactName (),
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- resultArtifact.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC write to file failed");
- }
+ try (FileOutputStream outFile = new FileOutputStream(System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactName())) {
+ outFile.write(payloadBytes, 0, payloadBytes.length);
+ }
+ } catch (Exception e) {
+ LOGGER.debug("Exception :",e);
+ LOGGER.error(MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
+ artifact.getArtifactName (),
+ artifact.getArtifactURL (),
+ artifact.getArtifactUUID (),
+ resultArtifact.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC write to file failed");
+ }
}