aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-adaptor/provider/src/main
diff options
context:
space:
mode:
authorTomek Kaminski <tomasz.kaminski@nokia.com>2018-01-10 16:51:15 +0100
committerSkip Wonnell <skip@att.com>2018-01-10 10:07:56 -0600
commit40bae6d46b1fc0d91da8b16d07b145c86ecf7c0c (patch)
treee3a739635f9df04097442c03587732fb68a37e5b /appc-config/appc-config-adaptor/provider/src/main
parentf5ae43c807a693e72d98bb4c3aa75f00234224ad (diff)
Fix sonar blockers
Fix https://sonar.onap.org/issues/search#issues=AWBUkk6L-08if2a6vTgG Change-Id: I5257f208b4df95129fcadfd5952988d8efdd8203 Issue-ID: APPC-383 Signed-off-by: Tomek Kaminski <tomasz.kaminski@nokia.com>
Diffstat (limited to 'appc-config/appc-config-adaptor/provider/src/main')
-rw-r--r--appc-config/appc-config-adaptor/provider/src/main/java/org/onap/appc/ccadaptor/SshJcraftWrapper.java15
1 files changed, 6 insertions, 9 deletions
diff --git a/appc-config/appc-config-adaptor/provider/src/main/java/org/onap/appc/ccadaptor/SshJcraftWrapper.java b/appc-config/appc-config-adaptor/provider/src/main/java/org/onap/appc/ccadaptor/SshJcraftWrapper.java
index 3b430bf68..1f161c3b0 100644
--- a/appc-config/appc-config-adaptor/provider/src/main/java/org/onap/appc/ccadaptor/SshJcraftWrapper.java
+++ b/appc-config/appc-config-adaptor/provider/src/main/java/org/onap/appc/ccadaptor/SshJcraftWrapper.java
@@ -1095,20 +1095,17 @@ public class SshJcraftWrapper {
ChannelSftp sftp = (ChannelSftp) sftpSession.openChannel("sftp");
debugLog.printRTAriDebug(fn, "Connecting....");
sftp.connect();
- InputStream in = null;
- in = sftp.get(fullFilePathName);
+ InputStream in = sftp.get(fullFilePathName);
String sftpFileString = readInputStreamAsString(in);
debugLog.printRTAriDebug(fn, "Retreived successfully");
- // debugLog.printRTAriDebug (fn, "sftpFileString="+sftpFileString);
- sftpSession.disconnect();
- sftpSession = null;
- return (sftpFileString);
+ return sftpFileString;
} catch (Exception e) {
debugLog.printRTAriDebug(fn, "Caught an Exception, e=" + e);
- sftpSession.disconnect();
- sftpSession = null;
- // dbLog.storeData("ErrorMsg= sftp threw an Exception. error is:"+e);
throw new IOException(e.toString());
+ } finally {
+ if(sftpSession != null) {
+ sftpSession.disconnect();
+ }
}
}