aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArindam Mondal <arind.mondal@samsung.com>2018-08-13 14:25:12 +0900
committerONAP <arind.mondal@samsung.com>2018-08-13 14:25:29 +0900
commit8e7e20e0d16c5ea42eec3c04d0a2d5e7e407420c (patch)
treeb2c233594745eea5749dc43c011354c5c26f4417
parent5bd7a5cb8a769ce7b6fa89d8df1b1863d977666f (diff)
Sonar issue Major
Issue-ID: SO-852 Change-Id: Ia0d58c52884abdd1f752dc6671d315b8516812e6 Signed-off-by: Arindam Mondal <arind.mondal@samsung.com>
-rw-r--r--common/src/main/java/org/onap/so/client/RestClientSSL.java14
1 files changed, 3 insertions, 11 deletions
diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java
index 461bb5832c..8eaeee97ee 100644
--- a/common/src/main/java/org/onap/so/client/RestClientSSL.java
+++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java
@@ -72,23 +72,15 @@ public abstract class RestClientSSL extends RestClient {
private KeyStore getKeyStore() {
KeyStore ks = null;
char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray();
- FileInputStream fis = null;
- try {
+ try(FileInputStream fis = new FileInputStream(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY))) {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
- fis = new FileInputStream(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY));
+
ks.load(fis, password);
}
catch(Exception e) {
return null;
}
- finally {
- if (fis != null) {
- try {
- fis.close();
- }
- catch(Exception e) {}
- }
- }
+
return ks;
}
}