if (request.hasArgument()) {
dirName = request.getArgument();
}
// change directory
FileSystemView fsview = session.getFileSystemView();
boolean success = false;
try {
success = fsview.changeDirectory(dirName);
}
catch(Exception ex) {
LOG.debug("Failed to change directory in file system", ex);
}
if(success) {
dirName = fsview.getCurrentDirectory().getFullName();
session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "CWD", dirName));
}
else {
session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "CWD", null));
}