Sonar issue Major 89/60189/1
authorArindam Mondal <arind.mondal@samsung.com>
Mon, 13 Aug 2018 05:25:12 +0000 (14:25 +0900)
committerONAP <arind.mondal@samsung.com>
Mon, 13 Aug 2018 05:25:29 +0000 (14:25 +0900)
Issue-ID: SO-852
Change-Id: Ia0d58c52884abdd1f752dc6671d315b8516812e6
Signed-off-by: Arindam Mondal <arind.mondal@samsung.com>
common/src/main/java/org/onap/so/client/RestClientSSL.java

index 461bb58..8eaeee9 100644 (file)
@@ -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;
        }
 }