X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fnotification%2FNotificationPublisher.java;h=7d5b1cc5c33ea02a9977ecb7c48dd5743d28005a;hb=refs%2Fheads%2Fmaster;hp=4f552f73d3d943f2987449508aa6d9601309bc7f;hpb=7e6fe8c29c5a5cfa5caf6ab47b30280e1fc20432;p=aai%2Fmodel-loader.git 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 4f552f7..7d5b1cc 100644 --- a/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java +++ b/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java @@ -21,8 +21,8 @@ package org.onap.aai.modelloader.notification; import java.io.IOException; +import java.io.InputStream; import java.nio.file.Files; -import java.nio.file.Paths; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.Properties; @@ -38,10 +38,12 @@ import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.results.IDistributionClientResult; import org.onap.sdc.utils.DistributionActionResultEnum; import org.onap.sdc.utils.DistributionStatusEnum; +import org.springframework.stereotype.Component; /** * This class is responsible for publishing the status of actions performed working with artifacts. */ +@Component public class NotificationPublisher { private static Logger logger = LoggerFactory.getInstance().getLogger(NotificationPublisher.class); @@ -51,8 +53,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);