- sftpSession.setConfig(config);
- sftpSession.connect(30*1000);
- debugLog.printRTAriDebug (fn, "Opening up an sftp channel....");
- ChannelSftp sftp=(ChannelSftp)sftpSession.openChannel("sftp");
- debugLog.printRTAriDebug (fn, "Connecting....");
- sftp.connect();
- String oldFiles = fullPathDest +"*";
- debugLog.printRTAriDebug (fn, "Deleting old files --> "+oldFiles);
- try{
- sftp.rm(oldFiles);
- debugLog.printRTAriDebug (fn, "Sending stringOfData --> "+fullPathDest);
- }
- catch(SftpException sft){
- String exp = "No such file";
- if(sft.getMessage()!=null && sft.getMessage().contains(exp))
- debugLog.printRTAriDebug (fn, "No files found -- Continue");
- else{
- debugLog.printRTAriDebug (fn, "Exception while sftp.rm " + sft.getMessage());
- sft.printStackTrace();
- throw sft;
- }
- }
- 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);
+ sftpSession.setConfig(config);
+ sftpSession.connect(30 * 1000);
+ debugLog.printRTAriDebug(fn, "Opening up an sftp channel....");
+ ChannelSftp sftp = (ChannelSftp) sftpSession.openChannel("sftp");
+ debugLog.printRTAriDebug(fn, "Connecting....");
+ sftp.connect();
+ String oldFiles = fullPathDest + "*";
+ debugLog.printRTAriDebug(fn, "Deleting old files --> " + oldFiles);
+ try {
+ sftp.rm(oldFiles);
+ debugLog.printRTAriDebug(fn, "Sending stringOfData --> " + fullPathDest);
+ } catch (SftpException sft) {
+ String exp = "No such file";
+ if (sft.getMessage() != null && sft.getMessage().contains(exp)) {
+ debugLog.printRTAriDebug(fn, "No files found -- Continue");
+ } else {
+ debugLog.printRTAriDebug(fn, "Exception while sftp.rm " + sft.getMessage());
+ sft.printStackTrace();
+ throw sft;
+ }
+ }
+ 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);