From 816033d0814d80050cf5dcc4ca8e489ff1b5c305 Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Mon, 23 Jul 2018 18:47:12 +0900 Subject: Fix use try-with-resources sonar issues Replace try with try-with-resources statement Issue-ID: SO-703 Change-Id: I971b61af2070a6856c751ed36050dd018216fe03 Signed-off-by: Parshad Patel --- .../mso/client/defaultproperties/DefaultAAIPropertiesImpl.java | 3 +-- .../mso/client/defaultproperties/PolicyRestPropertiesImpl.java | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java b/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java index 3f5bfa97d0..ce08759dd9 100644 --- a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java +++ b/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java @@ -40,8 +40,7 @@ public class DefaultAAIPropertiesImpl implements AAIProperties { public DefaultAAIPropertiesImpl() { File initialFile = new File("src/test/resources/aai.properties"); Map temp; - try { - InputStream targetStream = new FileInputStream(initialFile); + try(InputStream targetStream = new FileInputStream(initialFile)) { Properties properties = new Properties(); properties.load(targetStream); temp = properties; diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java b/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java index 77d67d70fc..655dc5a83d 100644 --- a/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java +++ b/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java @@ -38,10 +38,9 @@ public class PolicyRestPropertiesImpl implements PolicyRestProperties { final Map props; public PolicyRestPropertiesImpl() { File initialFile = new File("src/test/resources/policy.properties"); - InputStream targetStream; + Map temp; - try { - targetStream = new FileInputStream(initialFile); + try(InputStream targetStream = new FileInputStream(initialFile)) { Properties properties = new Properties(); properties.load(targetStream); temp = properties; -- cgit 1.2.3-korg