diff options
author | Marcus Williams <marcus.williams@intel.com> | 2018-08-13 19:43:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-13 19:43:10 +0000 |
commit | de0812a382df2347f4b2b420df97a67560c213ac (patch) | |
tree | 4d5e3014be536fa4902fb264d716babca9ec79ee /common/src/main/java | |
parent | a81aef2172c2cb4c6735f6018aee7deb04140b5d (diff) | |
parent | 8e7e20e0d16c5ea42eec3c04d0a2d5e7e407420c (diff) |
Merge "Sonar issue Major"
Diffstat (limited to 'common/src/main/java')
-rw-r--r-- | common/src/main/java/org/onap/so/client/RestClientSSL.java | 14 |
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; } } |