diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2018-07-25 09:47:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-07-25 09:47:24 +0000 |
commit | d100b51d226c436b4362af4114e7975893cb933f (patch) | |
tree | 1047d3019a9a2599fb55e32437be83bf34cd991f | |
parent | c7e15b3d7fb9bf9d4efc8bff361ee6f0c6dbb268 (diff) | |
parent | 816033d0814d80050cf5dcc4ca8e489ff1b5c305 (diff) |
Merge "Fix use try-with-resources sonar issues"
2 files changed, 3 insertions, 5 deletions
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<Object, Object> 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<Object, Object> props; public PolicyRestPropertiesImpl() { File initialFile = new File("src/test/resources/policy.properties"); - InputStream targetStream; + Map<Object, Object> temp; - try { - targetStream = new FileInputStream(initialFile); + try(InputStream targetStream = new FileInputStream(initialFile)) { Properties properties = new Properties(); properties.load(targetStream); temp = properties; |