From 6dc1f4c1f69f1a02926a0bcc06b812a0c28f3e34 Mon Sep 17 00:00:00 2001 From: surya-huawei Date: Thu, 28 Sep 2017 11:16:21 +0530 Subject: Close the inputstream *Use try with resources to close the resource This is done to ensure that the resource is closed Issue-Id: CCSDK-87 Change-Id: Ie5ebcffcec3350902305b35909e64d3cd518c49b Signed-off-by: surya-huawei --- .../src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java index 840062e7..d3d57eaa 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java @@ -290,12 +290,11 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe ctx = SSLContext.getInstance("TLS"); KeyManagerFactory kmf = null; - try { + try (FileInputStream fin = new FileInputStream(keystore_path)){ String def = "SunX509"; String storeType = "PKCS12"; def = KeyStore.getDefaultType(); kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - FileInputStream fin = new FileInputStream(keystore_path); String extension = keystore_path.substring(keystore_path.lastIndexOf(".") + 1); if("JKS".equalsIgnoreCase(extension)) { -- cgit 1.2.3-korg