diff options
author | Tian Lee <TianL@amdocs.com> | 2018-06-27 10:43:30 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-06-27 10:43:30 +0000 |
commit | c68bb59a80df56a8426afad811d8e1833a5748a6 (patch) | |
tree | 65acb2edfb00679951b74f99a0caddb3d50c9694 | |
parent | d7acebd26bf5380c21e654bd0e562b96283a5873 (diff) | |
parent | 07c45d4e49c334d11d91bfadbd7b68c437007b01 (diff) |
Merge "Fix sonar issues in /crud/util/CrudProperties.java"
-rw-r--r-- | src/main/java/org/onap/crud/util/CrudProperties.java | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/main/java/org/onap/crud/util/CrudProperties.java b/src/main/java/org/onap/crud/util/CrudProperties.java index 7d31691..118aed3 100644 --- a/src/main/java/org/onap/crud/util/CrudProperties.java +++ b/src/main/java/org/onap/crud/util/CrudProperties.java @@ -53,21 +53,11 @@ public class CrudProperties { public static void put(String key, String value) { properties.setProperty(key, value); - FileOutputStream fileOut = null; - try { - fileOut = new FileOutputStream(new File(CrudServiceConstants.CRD_CONFIG_FILE)); + try (FileOutputStream fileOut = new FileOutputStream(new File(CrudServiceConstants.CRD_CONFIG_FILE))) { properties.store(fileOut, "Added property: " + key); } catch (Exception e) { e.printStackTrace(); - } finally { - - try { - fileOut.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } } - } |