summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjegadeeshbabu1 <jegabab1@in.ibm.com>2019-07-10 15:43:05 +0530
committerjegadeeshbabu1 <jegabab1@in.ibm.com>2019-07-10 15:44:50 +0530
commit39c180873d82310b9812c2c7d9b0efc56d9b09d1 (patch)
tree35fc9055728172749a7998cf2d24a9ad99f5e980 /src
parenta83c036d46be00d1ca0b6bbff27382aa847240e1 (diff)
Handled unclosed resources using try-with-resources statement
Used try-with-resources Issue-ID: MUSIC-432 Change-Id: I1b2df10324fbfc100499b7de4c2414a44e232aec Signed-off-by: jegadeeshbabu1 <jegabab1@in.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/music/main/CipherUtil.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/org/onap/music/main/CipherUtil.java b/src/main/java/org/onap/music/main/CipherUtil.java
index 0d5b7710..53333238 100644
--- a/src/main/java/org/onap/music/main/CipherUtil.java
+++ b/src/main/java/org/onap/music/main/CipherUtil.java
@@ -1,9 +1,11 @@
/*
* ============LICENSE_START==========================================
- * org.onap.music
+ * org.onap.music
* ===================================================================
* Copyright (c) 2017 AT&T Intellectual Property
* ===================================================================
+ * Modification Copyright (c) 2019 IBM
+ * ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -245,13 +247,12 @@ public class CipherUtil {
public static void readAndSetKeyString() {
- try {
- Scanner in = new Scanner(new FileReader("/opt/app/music/etc/properties.txt"));
+ try (Scanner in = new Scanner(new FileReader("/opt/app/music/etc/properties.txt"))) {
+
StringBuilder sb = new StringBuilder();
while(in.hasNext()) {
sb.append(in.next());
}
- in.close();
keyString = sb.toString();
} catch (FileNotFoundException e) {
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());