summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-adaptor
diff options
context:
space:
mode:
authorTomek Kaminski <tomasz.kaminski@nokia.com>2018-01-10 14:31:14 +0100
committerTomek Kaminski <tomasz.kaminski@nokia.com>2018-01-10 14:56:53 +0100
commitf5ae43c807a693e72d98bb4c3aa75f00234224ad (patch)
tree67a439ffada9d5f9e5ba03f2022cee5540a0032d /appc-config/appc-config-adaptor
parent939d33e7468582edf643de2d66f06fa4b638ed67 (diff)
Fix sonar blockers
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>
Diffstat (limited to 'appc-config/appc-config-adaptor')
-rw-r--r--appc-config/appc-config-adaptor/provider/src/main/java/org/onap/appc/ccadaptor/SshJcraftWrapper.java12
1 files changed, 6 insertions, 6 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 e0e33c456..3b430bf68 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
@@ -54,6 +54,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.StringTokenizer;
+import org.apache.commons.lang.StringUtils;
public class SshJcraftWrapper {
@@ -375,7 +376,7 @@ public class SshJcraftWrapper {
String fnName = "SshJcraftWrapper.checkIfReceivedStringMatchesDelimeter:::";
int x;
int c;
- String str = null;
+ String str = StringUtils.EMPTY;
if (jcraftReadSwConfigFileFromDisk()) {
DebugLog.printAriDebug(fnName, "jcraftReadSwConfigFileFromDisk block");
@@ -1065,14 +1066,13 @@ public class SshJcraftWrapper {
}
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);
- 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();
+ }
}
}