aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleksandr Moliavko <o.moliavko@samsung.com>2019-08-06 11:59:56 +0300
committerOleksandr Moliavko <o.moliavko@samsung.com>2019-08-06 11:59:56 +0300
commit8cfa1b81d64c69c4a78dc5ac2b205418dabcbe91 (patch)
treebf1c9649c9ad42a326e2d0751e137d5dee6a0b5a
parent3b7a7443e320d6dcf9a034b0ca290598316d8821 (diff)
Added close() call for InputStream instance to
remove static analyzer warning about handle leak in getMsoAaiPassword() Issue-ID: SO-1841 Signed-off-by: Oleksandr Moliavko <o.moliavko@samsung.com> Change-Id: I2be9cc72f78275a80c6f03d806bea2ad275f23b4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
index dc2b3be073..5c0406cc9e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
@@ -24,6 +24,7 @@
package org.onap.so.bpmn.common.util;
import java.io.IOException;
+import java.io.InputStream;
import java.security.GeneralSecurityException;
import java.util.Properties;
import org.onap.so.utils.CryptoUtils;
@@ -40,7 +41,10 @@ public class CryptoHandler implements ICryptoHandler {
public String getMsoAaiPassword() {
Properties keyProp = new Properties();
try {
- keyProp.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("urn.properties"));
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ InputStream rs = cl.getResourceAsStream("urn.properties");
+ keyProp.load(rs);
+ rs.close();
return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY);
} catch (GeneralSecurityException | IOException e) {
logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);