Program: 152329
Project: 152329
Buggy source:
/** 
 * Execute command.
 */
public void execute(RequestHandler handler,FtpRequestImpl request,FtpWriter out) throws IOException, FtpException {
  boolean success=false;
  FtpServerContext serverContext=handler.getServerContext();
  Log log=serverContext.getLogFactory().getInstance(getClass());
  ConnectionManager conManager=serverContext.getConnectionManager();
  ServerFtpStatistics stat=(ServerFtpStatistics)serverContext.getFtpStatistics();
  try {
    request.resetState();
    String password=request.getArgument();
    if (password == null) {
      out.send(501,"String_Node_Str",null);
      return;
    }
    String userName=request.getUserArgument();
    User user=request.getUser();
    if (userName == null && user == null) {
      out.send(503,"String_Node_Str",null);
      return;
    }
    if (request.isLoggedIn()) {
      out.send(202,"String_Node_Str",null);
      success=true;
      return;
    }
    boolean anonymous=userName.equals("String_Node_Str");
    int currAnonLogin=stat.getCurrentAnonymousLoginNumber();
    int maxAnonLogin=conManager.getMaxAnonymousLogins();
    if (anonymous && (currAnonLogin >= maxAnonLogin)) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    int currLogin=stat.getCurrentLoginNumber();
    int maxLogin=conManager.getMaxLogins();
    if (maxLogin != 0 && currLogin >= maxLogin) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    UserManager userManager=serverContext.getUserManager();
    user=null;
    try {
      Authentication auth;
      if (anonymous) {
        auth=new AnonymousAuthentication();
      }
 else {
        auth=new UsernamePasswordAuthentication(userName,password);
      }
      user=userManager.authenticate(auth);
    }
 catch (    Exception ex) {
      success=false;
      log.warn("String_Node_Str",ex);
    }
    Ftplet ftpletContainer=serverContext.getFtpletContainer();
    if (ftpletContainer != null) {
      FtpletEnum ftpletRet;
      try {
        ftpletRet=ftpletContainer.onLogin(request,out);
      }
 catch (      Exception e) {
        ftpletRet=FtpletEnum.RET_DISCONNECT;
      }
      if (ftpletRet == FtpletEnum.RET_DISCONNECT) {
        serverContext.getConnectionManager().closeConnection(handler);
        return;
      }
 else       if (ftpletRet == FtpletEnum.RET_SKIP) {
        success=false;
      }
    }
    if (success) {
      request.setUser(user);
      request.setUserArgument(null);
      request.setMaxIdleTime(user.getMaxIdleTime());
    }
 else {
      log.warn("String_Node_Str" + userName);
      out.send(530,"String_Node_Str",userName);
      stat.setLoginFail(handler);
      return;
    }
    FileSystemManager fmanager=serverContext.getFileSystemManager();
    FileSystemView fsview=fmanager.createFileSystemView(user);
    request.setLogin(fsview);
    stat.setLogin(handler);
    out.send(230,"String_Node_Str",userName);
    if (anonymous) {
      log.info("String_Node_Str" + password);
    }
 else {
      log.info("String_Node_Str" + userName);
    }
  }
  finally {
    if (!success) {
      request.reinitialize();
    }
  }
}

Fixed version (ground truth):
/** 
 * Execute command.
 */
public void execute(RequestHandler handler,FtpRequestImpl request,FtpWriter out) throws IOException, FtpException {
  boolean success=false;
  FtpServerContext serverContext=handler.getServerContext();
  Log log=serverContext.getLogFactory().getInstance(getClass());
  ConnectionManager conManager=serverContext.getConnectionManager();
  ServerFtpStatistics stat=(ServerFtpStatistics)serverContext.getFtpStatistics();
  try {
    request.resetState();
    String password=request.getArgument();
    if (password == null) {
      out.send(501,"String_Node_Str",null);
      return;
    }
    String userName=request.getUserArgument();
    User user=request.getUser();
    if (userName == null && user == null) {
      out.send(503,"String_Node_Str",null);
      return;
    }
    if (request.isLoggedIn()) {
      out.send(202,"String_Node_Str",null);
      success=true;
      return;
    }
    boolean anonymous=userName.equals("String_Node_Str");
    int currAnonLogin=stat.getCurrentAnonymousLoginNumber();
    int maxAnonLogin=conManager.getMaxAnonymousLogins();
    if (anonymous && (currAnonLogin >= maxAnonLogin)) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    int currLogin=stat.getCurrentLoginNumber();
    int maxLogin=conManager.getMaxLogins();
    if (maxLogin != 0 && currLogin >= maxLogin) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    UserManager userManager=serverContext.getUserManager();
    user=null;
    try {
      Authentication auth;
      if (anonymous) {
        auth=new AnonymousAuthentication();
      }
 else {
        auth=new UsernamePasswordAuthentication(userName,password);
      }
      user=userManager.authenticate(auth);
      success=true;
    }
 catch (    Exception ex) {
      success=false;
      log.warn("String_Node_Str",ex);
    }
    Ftplet ftpletContainer=serverContext.getFtpletContainer();
    if (ftpletContainer != null) {
      FtpletEnum ftpletRet;
      try {
        ftpletRet=ftpletContainer.onLogin(request,out);
      }
 catch (      Exception e) {
        ftpletRet=FtpletEnum.RET_DISCONNECT;
      }
      if (ftpletRet == FtpletEnum.RET_DISCONNECT) {
        serverContext.getConnectionManager().closeConnection(handler);
        return;
      }
 else       if (ftpletRet == FtpletEnum.RET_SKIP) {
        success=false;
      }
    }
    if (success) {
      request.setUser(user);
      request.setUserArgument(null);
      request.setMaxIdleTime(user.getMaxIdleTime());
    }
 else {
      log.warn("String_Node_Str" + userName);
      out.send(530,"String_Node_Str",userName);
      stat.setLoginFail(handler);
      return;
    }
    FileSystemManager fmanager=serverContext.getFileSystemManager();
    FileSystemView fsview=fmanager.createFileSystemView(user);
    request.setLogin(fsview);
    stat.setLogin(handler);
    out.send(230,"String_Node_Str",userName);
    if (anonymous) {
      log.info("String_Node_Str" + password);
    }
 else {
      log.info("String_Node_Str" + userName);
    }
  }
  finally {
    if (!success) {
      request.reinitialize();
    }
  }
}