Fix https://sonar.onap.org/issues/search#issues=AWBUkk6L-08if2a6vTgF
Fix https://sonar.onap.org/issues/search#issues=AWBUkk6L-08if2a6vTgG
Change-Id: If5fa742580c59db96e62405fd8b02d34de5656ba
Issue-ID: APPC-383
Signed-off-by: Tomek Kaminski <tomasz.kaminski@nokia.com>
import java.util.Calendar;
import java.util.Date;
import java.util.StringTokenizer;
import java.util.Calendar;
import java.util.Date;
import java.util.StringTokenizer;
+import org.apache.commons.lang.StringUtils;
public class SshJcraftWrapper {
public class SshJcraftWrapper {
String fnName = "SshJcraftWrapper.checkIfReceivedStringMatchesDelimeter:::";
int x;
int c;
String fnName = "SshJcraftWrapper.checkIfReceivedStringMatchesDelimeter:::";
int x;
int c;
+ String str = StringUtils.EMPTY;
if (jcraftReadSwConfigFileFromDisk()) {
DebugLog.printAriDebug(fnName, "jcraftReadSwConfigFileFromDisk block");
if (jcraftReadSwConfigFileFromDisk()) {
DebugLog.printAriDebug(fnName, "jcraftReadSwConfigFileFromDisk block");
}
sftp.put(is, fullPathDest, ChannelSftp.OVERWRITE);
debugLog.printRTAriDebug(fn, "Sent successfully");
}
sftp.put(is, fullPathDest, ChannelSftp.OVERWRITE);
debugLog.printRTAriDebug(fn, "Sent successfully");
- sftpSession.disconnect();
- sftpSession = null;
} catch (Exception e) {
debugLog.printRTAriDebug(fn, "Caught an Exception, e=" + e);
} 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());
throw new IOException(e.toString());
+ } finally {
+ if(sftpSession != null) {
+ sftpSession.disconnect();
+ }