Source:
<code>public Serializable execute(TaskResult... results) throws IOException, JSchException, SftpException { List<String> filesRelativePathName = null; ChannelSftp channelsftp = null; Session session = null; Channel channel = null; try { JSch jsch = new JSch(); session = jsch.getSession(sftpUsername, sftpHostname, sftpPort); session.setPassword(sftpPassword); <START> Properties config = new Properties(); <END> config.put("StrictHostKeyChecking", "no"); session.setConfig(config); getOut().println("Connecting to " + sftpUrlKey); session.connect(); channel = session.openChannel("sftp"); channel.connect(); channelsftp = (ChannelSftp) channel; switch (sftpMode) { case "GET": getOut().println("BEGIN DOWNLOAD FROM SFTP SERVER: " + sftpUrlKey); filesRelativePathName = recursiveFolderDownload(channelsftp, sftpRemoteRelativePath, sftpLocalRelativePath); getOut().println("END DOWNLOAD FROM SFTP"); break; case "PUT": getOut().println("BEGIN UPLOAD TO SFTP SERVER: " + sftpUrlKey); if (!remoteDirExists(channelsftp, sftpRemoteRelativePath)) { makeRemoteDirectories(channelsftp, Paths.get(sftpRemoteRelativePath)); } filesRelativePathName = recursiveFolderUpload(channelsftp, sftpLocalRelativePath, sftpRemoteRelativePath); getOut().println("END UPLOAD TO SFTP"); break; default: throw new IllegalArgumentException("SFTP mode can only be PUT or GET."); } } catch (JSchException e) { throw new JSchException("An error occured while trying to connect to SFTP server: ", e); } catch (SftpException e) { throw new SftpException(e.id, "File not found, permission denied or operation not supported by SFTP server.", e); } finally { if (channelsftp != null) channelsftp.disconnect(); if (channel != null) channel.disconnect(); if (session != null) session.disconnect(); getOut().println("Disconnected from SFTP server"); } return (Serializable) filesRelativePathName; }</code><technical_language>extract lines of SSH configuration in a dedicated private method (in case need add more config for exmaple)</technical_language>

Target:
public Serializable execute(TaskResult... results) throws IOException, JSchException, SftpException { List<String> filesRelativePathName = null; ChannelSftp channelsftp = null; Session session = null; Channel channel = null; try { JSch jsch = new JSch(); session = jsch.getSession(sftpUsername, sftpHostname, sftpPort); session.setPassword(sftpPassword); Properties config = new Properties(); config.put(STRICT_HOST_KEY_CHEKING, "no"); session.setConfig(config); getOut().println("Connecting to " + sftpUrlKey); session.connect(); channel = session.openChannel("sftp"); channel.connect(); channelsftp = (ChannelSftp) channel; switch (sftpMode) { case GET: getOut().println("BEGIN DOWNLOAD FROM SFTP SERVER: " + sftpUrlKey); filesRelativePathName = recursiveFolderDownload(channelsftp, sftpRemoteRelativePath, sftpLocalAbsolutePath); getOut().println("END DOWNLOAD FROM SFTP"); break; case PUT: getOut().println("BEGIN UPLOAD TO SFTP SERVER: " + sftpUrlKey); if (!remoteDirExists(channelsftp, sftpRemoteRelativePath)) { makeRemoteDirectories(channelsftp, Paths.get(sftpRemoteRelativePath)); } filesRelativePathName = recursiveFolderUpload(channelsftp, sftpLocalAbsolutePath, sftpRemoteRelativePath); getOut().println("END UPLOAD TO SFTP"); break; default: throw new IllegalArgumentException("SFTP mode can only be " + PUT + " or " + GET); } } catch (JSchException e) { throw new JSchException("An error occured while trying to connect to SFTP server: ", e.getCause()); } catch (SftpException e) { throw new SftpException(e.id, "File not found, permission denied or operation not supported by SFTP server.", e); } finally { if (channelsftp != null) { channelsftp.disconnect(); } if (channel != null) { channel.disconnect(); } if (session != null) { session.disconnect(); } getOut().println("Disconnected from SFTP server"); } return (Serializable) filesRelativePathName; }