Hello Support Team,
We are using EDT Java API to connect with SFTP server. We are getting exception while using wild card e.g. "abc*xyz". In all other cases there is no exception.
Same thing is running smoothly with local server, some of our production servers but one sepcific server is giving this this Exception
Here is the source I used for this, kindly guide:
public void newCodeTestReadingAPIDoc() {
try {
SSLFTPClient ftp = new SSLFTPClient();
ftp.setRemoteHost(remoteHost);
ftp.setRemotePort(remotePort);
ftp.setConfigFlags(SSLFTPClient.ConfigFlags.DISABLE_WAIT_ON_CLOSE
| SSLFTPClient.ConfigFlags.DISABLE_SSL_CLOSURE);
ftp.setImplicitFTPS(true);
System.out.println("Importing the server certificate...");
ftp.getRootCertificateStore().importPEMFile(serverCertPath);
System.out.println("Connecting to " + remoteHost);
ftp.connect();
System.out.println("Auth with PROT PRIVATE.");
ftp.auth(SSLFTPClient.PROT_PRIVATE);
System.out.println("Login to " + remoteHost);
ftp.login(userId, userPw);
if (ftp.pwd().equals(remotePath) == false) {
System.out.println("Changing to directory " + remotePath);
ftp.chdir(remotePath);
}
System.out.println("Getting directory listing of: " + remotePath);
String[] files = ftp.dir(wildCard);
System.out.println("Total Files Found: " + files.length);
for (int i = 0; i < files.length; i++) {
System.out.println("File Name: " + files[i]);
}
// close the connection
ftp.quit();
} catch (SSLFTPCertificateException e) {
System.out.println("Failed to connect. Certificates are: ");
e.printCertificates();
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
Here is the Exception occured with ft.dir(wildCard) line:
com.enterprisedt.net.puretls.SSLHandshakeFailedException: com.enterprisedt.net.puretls.SSLPrematureCloseException: Short read
at com.enterprisedt.net.puretls.i.G(Unknown Source)
at com.enterprisedt.net.puretls.SSLSocket.handshake(Unknown Source)
at com.enterprisedt.net.ftp.ssl.C.A(Unknown Source)
at com.enterprisedt.net.ftp.ssl.C.getInputStream(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.dir(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.dir(Unknown Source)
Regards,
Faisal Maqsood