summaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-chef-adapter
diff options
context:
space:
mode:
authorSkip Wonnell <kw5258@att.com>2017-07-19 22:02:57 -0400
committerSkip Wonnell <kw5258@att.com>2017-07-20 10:37:54 -0400
commit8dfd2a33c3d645b06e5cb05a811f739697c0ee2b (patch)
tree63db199694e1c5d8d2d1947abf68bf3fb0bbe514 /appc-adapters/appc-chef-adapter
parent10bba35de2cc3b2c33cb2a1f04cae45bbdcd0c4e (diff)
[APPC-93] Resource leak in appc.adapter.chef.chefclient.Utils
Place instantiation of FileReader and BufferedReader inside a TWR Change-Id: Ibc0fffa76e536bdccca92731dc7ebc878faf67a1 Signed-off-by: Skip Wonnell <kw5258@att.com>
Diffstat (limited to 'appc-adapters/appc-chef-adapter')
-rw-r--r--appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefclient/Utils.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefclient/Utils.java b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefclient/Utils.java
index fc64af5d4..07c983a43 100644
--- a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefclient/Utils.java
+++ b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/chefclient/Utils.java
@@ -62,15 +62,9 @@ public class Utils {
public static String signWithRSA(String inStr, String pemPath) {
byte[] outStr = null;
- BufferedReader br = null;
- try {
- br = new BufferedReader(new FileReader(pemPath));
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
Security.addProvider(new BouncyCastleProvider());
- try {
-
+ try (FileReader fr = new FileReader(pemPath);
+ BufferedReader br = new BufferedReader(fr)) {
PEMParser pemParser = new PEMParser(br);
JcaPEMKeyConverter converter = new JcaPEMKeyConverter();
Object object = pemParser.readObject();