From c71e5ead007cafce9c9ef40d5bdc2fdd22d0e798 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Fri, 29 Jul 2016 12:05:23 +0530 Subject: [PATCH] few fixes in JWT Client --- .../jwt/client/extension/util/JWTClientUtil.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/main/java/org/wso2/carbon/identity/jwt/client/extension/util/JWTClientUtil.java b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/main/java/org/wso2/carbon/identity/jwt/client/extension/util/JWTClientUtil.java index 2786b7a00db..4f62dd6a628 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/main/java/org/wso2/carbon/identity/jwt/client/extension/util/JWTClientUtil.java +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/main/java/org/wso2/carbon/identity/jwt/client/extension/util/JWTClientUtil.java @@ -116,10 +116,18 @@ public class JWTClientUtil { throws RegistryException, IOException, JWTClientConfigurationException { File configFile = new File(SUPERTENANT_JWT_CONFIG_LOCATION); if (configFile.exists()) { - InputStream propertyStream = configFile.toURI().toURL().openStream(); - Properties properties = new Properties(); - properties.load(propertyStream); - jwtClientManagerService.setDefaultJWTClient(properties); + InputStream propertyStream = null; + try { + propertyStream = configFile.toURI().toURL().openStream(); + Properties properties = new Properties(); + properties.load(propertyStream); + jwtClientManagerService.setDefaultJWTClient(properties); + } finally { + if (propertyStream != null) { + propertyStream.close(); + } + } + } }