Hello,
sometimes I get this
INFO [25 Aug 2008 23:38:02.374] Getting file 18 out of 56
INFO [25 Aug 2008 23:38:02.374] ftpHost : xxxxxx
DEBUG [25 Aug 2008 23:38:02.374] ftpUserName : xxxx
DEBUG [25 Aug 2008 23:38:02.374] ftpPassword : xxxx
DEBUG [25 Aug 2008 23:38:02.374] ftpRemoteDirectory :
INFO [25 Aug 2008 23:38:02.374] ftpRemoteFile : MTVA.xml
DEBUG [25 Aug 2008 23:38:02.389] replyReceived: 220 xxx.yyi FTP server ready
DEBUG [25 Aug 2008 23:38:02.389] Command sent: ---> USER xxxx
DEBUG [25 Aug 2008 23:38:02.391] replyReceived: 331 User name okay, need password.
DEBUG [25 Aug 2008 23:38:02.391] Command sent: ---> PASS ********
DEBUG [25 Aug 2008 23:38:02.399] replyReceived: 230 User logged in, proceed.
DEBUG [25 Aug 2008 23:38:02.399] Command sent: ---> TYPE I
DEBUG [25 Aug 2008 23:38:02.414] replyReceived: 200 Type set to I.
DEBUG [25 Aug 2008 23:38:02.414] Command sent: ---> PORT 10,8,0,31,192,75
DEBUG [25 Aug 2008 23:38:02.416] replyReceived: 200 PORT Command successful.
DEBUG [25 Aug 2008 23:38:02.417] Command sent: ---> RETR MTVA.xml
DEBUG [25 Aug 2008 23:38:02.421] replyReceived: 500 'R': command not understood.
DEBUG [25 Aug 2008 23:38:02.421] Command sent: ---> QUIT
DEBUG [25 Aug 2008 23:38:02.628] replyReceived: 500 'L': command not understood.
WARN [25 Aug 2008 23:38:02.628] REMOVE ME
com.enterprisedt.net.ftp.FTPException: 'L': command not understood.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:977)
at com.enterprisedt.net.ftp.FTPClient.quit(FTPClient.java:3490)
at com.enterprisedt.net.ftp.FileTransferClient.disconnect(FileTransferClient.java:812)
...
Anybody has a hint? I can not administer the ftp server. I use edtftpj 2.0.2.
This is java code:
public InputStream getDocumentOverFtpFrom(URI uri) {
String ftpHost = uri.getHost();
String ftpUserName = StringUtils.substringBefore(uri.getAuthority(), ":");
String ftpPassword = StringUtils.substringBetween(uri.getAuthority(), ":", "@");
String ftpRemoteDirectory = "";
String ftpRemoteFile = StringUtils.substringAfterLast(uri.getPath(), "/");
logger.info("ftpHost : " + ftpHost);
logger.debug("ftpUserName : " + ftpUserName);
logger.debug("ftpPassword : " + ftpPassword);
logger.debug("ftpRemoteDirectory : " + ftpRemoteDirectory);
logger.info("ftpRemoteFile : " + ftpRemoteFile);
FileTransferClient ftp = null;
FTPInputStream is = null;
ByteArrayInputStream byteArrayInputStream = null;
try {
ftp = new FileTransferClient();
ftp.setEventListener(new EventListenerImpl());
ftp.setRemoteHost(ftpHost);
ftp.setUserName(ftpUserName);
ftp.setPassword(ftpPassword);
try {
InetAddress addr = InetAddress.getLocalHost();
String ip = addr.getHostAddress();
ftp.getAdvancedFTPSettings().setActiveIPAddress(ip);
} catch (UnknownHostException e) {
}
int tryCount = 1;
boolean notSuccessfullyTransferred = true;
do {
try {
if(tryCount > 1) {
logger.info("Retrying...");
}
ftp.connect();
is = (FTPInputStream) ftp.downloadStream(ftpRemoteFile);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int len;
while ((len = is.read(buf)) > 0) {
bos.write(buf, 0, len);
}
byte[] data = bos.toByteArray();
byteArrayInputStream = new ByteArrayInputStream(data);
is.close();
notSuccessfullyTransferred = false;
} catch (Exception e) {
if (tryCount < 3) {
try {
ftp.disconnect();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
tryCount++;
} else {
logAndRecord(e, "[2]", ftpRemoteFile + "@" + ftpHost);