X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fmodel-loader.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fnotification%2FNotificationPublisher.java;fp=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fnotification%2FNotificationPublisher.java;h=6e6ff13e3ec1771d5aa05119891612f2ac28d0e9;hp=7ad552b3a42d2ca6f7337735ba73a5b84daeeb42;hb=b984f4c39231a32dd53d02e60741c7d32822aad0;hpb=e04245a22340f4b4e55182350dd4640547f98265 diff --git a/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java b/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java index 7ad552b..6e6ff13 100644 --- a/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java +++ b/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java @@ -21,6 +21,7 @@ package org.onap.aai.modelloader.notification; import java.io.IOException; +import java.io.InputStream; import java.nio.file.Files; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; @@ -50,8 +51,8 @@ public class NotificationPublisher { public NotificationPublisher() { Properties configProperties = new Properties(); - try { - configProperties.load(Files.newInputStream(ModelLoaderConfig.propertiesFile())); + try (InputStream configInputStream = Files.newInputStream(ModelLoaderConfig.propertiesFile())) { + configProperties.load(configInputStream); } catch (IOException e) { String errorMsg = "Failed to load configuration: " + e.getMessage(); logger.error(ModelLoaderMsgs.DISTRIBUTION_EVENT_ERROR, e, errorMsg);