Program: 152346
Project: 152346
Buggy source:
/** 
 * Execute command.
 */
public void execute(RequestHandler handler,FtpRequestImpl request,FtpWriter out) throws IOException, FtpException {
  boolean bSuccess=false;
  IFtpConfig fconfig=handler.getConfig();
  Log log=fconfig.getLogFactory().getInstance(getClass());
  IConnectionManager conManager=fconfig.getConnectionManager();
  IFtpStatistics stat=(IFtpStatistics)fconfig.getFtpStatistics();
  try {
    request.resetState();
    String password=request.getArgument();
    if (password == null) {
      out.send(501,"String_Node_Str",null);
      return;
    }
    String userName=request.getUserArgument();
    if (userName == null) {
      out.send(503,"String_Node_Str",null);
      return;
    }
    if (request.isLoggedIn()) {
      out.send(202,"String_Node_Str",null);
      bSuccess=true;
      return;
    }
    boolean bAnonymous=userName.equals("String_Node_Str");
    int currAnonLogin=stat.getCurrentAnonymousLoginNumber();
    int maxAnonLogin=conManager.getMaxAnonymousLogins();
    if (bAnonymous && (currAnonLogin >= maxAnonLogin)) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    int currLogin=stat.getCurrentLoginNumber();
    int maxLogin=conManager.getMaxLogins();
    if (currLogin >= maxLogin) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    UserManager userManager=fconfig.getUserManager();
    User user=null;
    try {
      if (bAnonymous) {
        bSuccess=userManager.doesExist("String_Node_Str");
        if (bSuccess)         user=userManager.getUserByName("String_Node_Str");
      }
 else {
        bSuccess=userManager.authenticate(userName,password);
        if (bSuccess)         user=userManager.getUserByName(userName);
      }
    }
 catch (    Exception ex) {
      bSuccess=false;
      log.warn("String_Node_Str",ex);
    }
    if (bSuccess) {
      request.setUser(user);
      request.setUserArgument(null);
      request.setMaxIdleTime(user.getMaxIdleTime());
    }
 else {
      log.warn("String_Node_Str" + userName);
      out.send(530,"String_Node_Str",userName);
      return;
    }
    FileSystemManager fmanager=fconfig.getFileSystemManager();
    FileSystemView fsview=fmanager.createFileSystemView(user);
    handler.setDirectoryLister(new DirectoryLister(fsview));
    request.setLogin(fsview);
    stat.setLogin(handler);
    out.send(230,"String_Node_Str",userName);
    if (bAnonymous) {
      log.info("String_Node_Str" + password);
    }
 else {
      log.info("String_Node_Str" + userName);
    }
    Ftplet ftpletContainer=fconfig.getFtpletContainer();
    FtpletEnum ftpletRet=ftpletContainer.onLogin(request,out);
    if (ftpletRet == FtpletEnum.RET_DISCONNECT) {
      fconfig.getConnectionManager().closeConnection(handler);
      return;
    }
  }
  finally {
    if (!bSuccess) {
      request.setUserArgument(null);
    }
  }
}

Fixed version (ground truth):
/** 
 * Execute command.
 */
public void execute(RequestHandler handler,FtpRequestImpl request,FtpWriter out) throws IOException, FtpException {
  boolean success=false;
  IFtpConfig fconfig=handler.getConfig();
  Log log=fconfig.getLogFactory().getInstance(getClass());
  IConnectionManager conManager=fconfig.getConnectionManager();
  IFtpStatistics stat=(IFtpStatistics)fconfig.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 (currLogin >= maxLogin) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    UserManager userManager=fconfig.getUserManager();
    user=null;
    try {
      if (anonymous) {
        success=userManager.doesExist("String_Node_Str");
        if (success) {
          user=userManager.getUserByName("String_Node_Str");
        }
      }
 else {
        success=userManager.authenticate(userName,password);
        if (success) {
          user=userManager.getUserByName(userName);
        }
      }
    }
 catch (    Exception ex) {
      success=false;
      log.warn("String_Node_Str",ex);
    }
    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);
      return;
    }
    FileSystemManager fmanager=fconfig.getFileSystemManager();
    FileSystemView fsview=fmanager.createFileSystemView(user);
    handler.setDirectoryLister(new DirectoryLister(fsview));
    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);
    }
    Ftplet ftpletContainer=fconfig.getFtpletContainer();
    if (ftpletContainer != null) {
      FtpletEnum ftpletRet=ftpletContainer.onLogin(request,out);
      if (ftpletRet == FtpletEnum.RET_DISCONNECT) {
        fconfig.getConnectionManager().closeConnection(handler);
        return;
      }
    }
  }
  finally {
    if (!success) {
      request.reinitialize();
    }
  }
}