|
a/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/utils/SSHManager.java |
|
b/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/utils/SSHManager.java |
|
... |
|
... |
134 |
}
|
134 |
}
|
135 |
|
135 |
|
136 |
session.disconnect();
|
136 |
session.disconnect();
|
137 |
}
|
137 |
}
|
138 |
|
138 |
|
139 |
public void directoryExists(Session session, Path... paths) throws SSHManagerException{
|
139 |
public void directoryExists(Session session, Path path) throws SSHManagerException{
|
140 |
|
140 |
|
141 |
if(!session.isConnected()){
|
141 |
if(!session.isConnected()){
|
142 |
try{
|
142 |
try{
|
143 |
session.connect();
|
143 |
session.connect();
|
144 |
}
|
144 |
}
|
|
... |
|
... |
154 |
} catch (JSchException e) {
|
154 |
} catch (JSchException e) {
|
155 |
throw new SSHManagerException(e.getLocalizedMessage());
|
155 |
throw new SSHManagerException(e.getLocalizedMessage());
|
156 |
}
|
156 |
}
|
157 |
|
157 |
|
158 |
ChannelSftp sftpChannel = (ChannelSftp) channel;
|
158 |
ChannelSftp sftpChannel = (ChannelSftp) channel;
|
159 |
for (Path path : paths) {
|
|
|
160 |
try {
|
159 |
try {
|
161 |
sftpChannel.lstat(path.toString()); // if dir not exists an exception is thrown
|
160 |
sftpChannel.lstat(path.toString()); // if dir not exists an exception is thrown
|
162 |
}catch (SftpException e) {
|
161 |
}catch (SftpException e) {
|
163 |
throw new SSHManagerException(path.toString()+" does not exists!" +e.getLocalizedMessage());
|
162 |
throw new SSHManagerException(path.toString()+" does not exists!" +e.getLocalizedMessage());
|
164 |
}
|
163 |
}
|
165 |
}
|
|
|
166 |
}
|
164 |
}
|
167 |
}
|
165 |
}
|