com.softicar.platform.common.network.sftp.SftpExceptionFatory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.network.sftp;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpException;
public class SftpExceptionFatory {
public static SftpRuntimeException create(SftpException sftpException) {
switch (sftpException.id) {
case ChannelSftp.SSH_FX_EOF:
return new SftpEndOfFileException(sftpException);
case ChannelSftp.SSH_FX_NO_SUCH_FILE:
return new SftpNoSuchFileException(sftpException);
case ChannelSftp.SSH_FX_PERMISSION_DENIED:
return new SftpPermissionDeniedException(sftpException);
case ChannelSftp.SSH_FX_NO_CONNECTION:
return new SftpNoConnectionException(sftpException);
case ChannelSftp.SSH_FX_CONNECTION_LOST:
return new SftpConnectionLostException(sftpException);
default:
return new SftpRuntimeException(sftpException);
}
}
}