FtpReplyUtil (now LocalizedFtpReply) returns empty strings in FTP replies
-------------------------------------------------------------------------
Key: FTPSERVER-199
URL: https://issues.apache.org/jira/browse/FTPSERVER-199
Project: FtpServer
Issue Type: Bug
Components: Core
Affects Versions: 1.0-M3
Environment: Windows XP SP2, SLES 10
Reporter: Randy Prager
Priority: Blocker
It seems FtpReplyUtil returns an empty strings swallowing valid return
messages. Definite issue in M3, not sure about M4 but it looks that way as
well.
For instance, FTP client issues PWD command as part of login and the server's
response is:
Command: PWD
Response: 257
NOTE: the directory is missing.
The offending code from FTPReplyUtil.java is :
private static String replaceVariables(FtpIoSession session,
FtpRequest request, FtpServerContext context, int code,
String basicMsg, String str) {
int startIndex = 0;
int openIndex = str.indexOf('{', startIndex);
if (openIndex == -1) {
return str;
}
int closeIndex = str.indexOf('}', startIndex);
if ((closeIndex == -1) || (openIndex > closeIndex)) {
return str;
}
String str is "", the return statements should be returning String basicMsg,
corrected code is:
int startIndex = 0;
int openIndex = str.indexOf('{', startIndex);
if (openIndex == -1) {
//return str;
return basicMsg;
}
int closeIndex = str.indexOf('}', startIndex);
if ((closeIndex == -1) || (openIndex > closeIndex)) {
//return str;
return basicMsg;
}
With this fix the client/server communication is:
Command: PWD
Response: 257 /
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.