fix:smb空指针问题修复

pull/2/head
dearlin 2023-11-08 17:15:45 +08:00
parent 8fc5375db9
commit 1197111074
1 changed files with 211 additions and 191 deletions

View File

@ -4,7 +4,9 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.Vector;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartFile;
import com.jcraft.jsch.Channel;
@ -15,18 +17,36 @@ import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpATTRS;
import com.jcraft.jsch.SftpException;
@Configuration
public class Smb {
public static String host;
public static Integer port;
public static String user;
public static String password;
public static String basePath;
@Value("${smb.host}")
private static String host;
public void setHostPath(String hostProperties){
host = hostProperties;
}
@Value("${smb.port}")
private static Integer port ;
public void setPortPath(Integer portProperties){
port = portProperties;
}
@Value("${smb.user}")
private static String user;
public void setUserPath(String userProperties){
user = userProperties;
}
@Value("${smb.password}")
private static String password;
public void setPasswordPath(String passwordProperties){
password = passwordProperties;
}
@Value("${smb.basePath}")
private static String basePath;
public void setBasePath(String basePathProperties){
basePath = basePathProperties;
}
// private static String host = "39.103.224.166";
//
@ -50,7 +70,6 @@ public class Smb {
public static final String SMBBAES_PATH = basePath;
public static void sshSftp(MultipartFile file, String fileName, String path) throws Exception {
Session session = null;
Channel channel = null;
@ -220,7 +239,8 @@ public class Smb {
/**
*
*Rhidd
* Rhidd
*
* @throws SftpException
* @throws JSchException
*/