Program: 152339
Project: 152339
Buggy source:
/** 
 * Execute command.
 */
public void execute(RequestHandler handler,FtpRequestImpl request,FtpWriter out) throws IOException, FtpException {
  try {
    request.resetState();
    IFtpConfig fconfig=handler.getConfig();
    String fileName=request.getArgument();
    if (fileName == null) {
      out.send(501,"String_Node_Str",null);
      return;
    }
    Ftplet ftpletContainer=fconfig.getFtpletContainer();
    FtpletEnum ftpletRet=ftpletContainer.onAppendStart(request,out);
    if (ftpletRet == FtpletEnum.RET_SKIP) {
      return;
    }
 else     if (ftpletRet == FtpletEnum.RET_DISCONNECT) {
      fconfig.getConnectionManager().closeConnection(handler);
      return;
    }
    FileObject file=null;
    try {
      file=request.getFileSystemView().getFileObject(fileName);
    }
 catch (    Exception ex) {
    }
    if (file == null) {
      out.send(550,"String_Node_Str",fileName);
      return;
    }
    fileName=file.getFullName();
    if (!(file.doesExist() && file.isFile())) {
      out.send(550,"String_Node_Str",fileName);
      return;
    }
    if (!file.hasWritePermission()) {
      out.send(550,"String_Node_Str",fileName);
      return;
    }
    out.send(150,"String_Node_Str",fileName);
    InputStream is=null;
    try {
      is=request.getDataInputStream();
    }
 catch (    IOException ex) {
      out.send(425,"String_Node_Str",fileName);
      return;
    }
    boolean failure=false;
    BufferedInputStream bis=null;
    BufferedOutputStream bos=null;
    try {
      bis=IoUtils.getBufferedInputStream(is);
      bos=IoUtils.getBufferedOutputStream(file.createOutputStream(true));
      int maxRate=handler.getRequest().getUser().getMaxUploadRate();
      long transSz=handler.transfer(bis,bos,maxRate);
      String userName=request.getUser().getName();
      Log log=fconfig.getLogFactory().getInstance(getClass());
      log.info("String_Node_Str" + userName + "String_Node_Str"+ fileName);
      IFtpStatistics ftpStat=(IFtpStatistics)fconfig.getFtpStatistics();
      ftpStat.setUpload(handler,file,transSz);
    }
 catch (    SocketException ex) {
      failure=true;
      out.send(426,"String_Node_Str",fileName);
    }
catch (    IOException ex) {
      failure=true;
      out.send(551,"String_Node_Str",fileName);
    }
 finally {
      IoUtils.close(bis);
      IoUtils.close(bos);
    }
    if (!failure) {
      out.send(226,"String_Node_Str",fileName);
      ftpletRet=ftpletContainer.onAppendEnd(request,out);
      if (ftpletRet == FtpletEnum.RET_DISCONNECT) {
        fconfig.getConnectionManager().closeConnection(handler);
        return;
      }
    }
  }
  finally {
    request.getFtpDataConnection().closeDataSocket();
  }
}

Fixed version (ground truth):
/** 
 * Execute command.
 */
public void execute(RequestHandler handler,FtpRequestImpl request,FtpWriter out) throws IOException, FtpException {
  try {
    request.resetState();
    IFtpConfig fconfig=handler.getConfig();
    String fileName=request.getArgument();
    if (fileName == null) {
      out.send(501,"String_Node_Str",null);
      return;
    }
    Ftplet ftpletContainer=fconfig.getFtpletContainer();
    FtpletEnum ftpletRet=ftpletContainer.onAppendStart(request,out);
    if (ftpletRet == FtpletEnum.RET_SKIP) {
      return;
    }
 else     if (ftpletRet == FtpletEnum.RET_DISCONNECT) {
      fconfig.getConnectionManager().closeConnection(handler);
      return;
    }
    FileObject file=null;
    try {
      file=request.getFileSystemView().getFileObject(fileName);
    }
 catch (    Exception ex) {
    }
    if (file == null) {
      out.send(550,"String_Node_Str",fileName);
      return;
    }
    fileName=file.getFullName();
    if (!(file.doesExist() && file.isFile())) {
      out.send(550,"String_Node_Str",fileName);
      return;
    }
    if (!file.hasWritePermission()) {
      out.send(550,"String_Node_Str",fileName);
      return;
    }
    out.send(150,"String_Node_Str",fileName);
    InputStream is=null;
    try {
      is=request.getDataInputStream();
    }
 catch (    IOException ex) {
      out.send(425,"String_Node_Str",fileName);
      return;
    }
    boolean failure=false;
    BufferedInputStream bis=null;
    BufferedOutputStream bos=null;
    try {
      long offset=0L;
      if (file.doesExist()) {
        offset=file.getSize();
      }
      bis=IoUtils.getBufferedInputStream(is);
      bos=IoUtils.getBufferedOutputStream(file.createOutputStream(offset));
      int maxRate=handler.getRequest().getUser().getMaxUploadRate();
      long transSz=handler.transfer(bis,bos,maxRate);
      String userName=request.getUser().getName();
      Log log=fconfig.getLogFactory().getInstance(getClass());
      log.info("String_Node_Str" + userName + "String_Node_Str"+ fileName);
      IFtpStatistics ftpStat=(IFtpStatistics)fconfig.getFtpStatistics();
      ftpStat.setUpload(handler,file,transSz);
    }
 catch (    SocketException ex) {
      failure=true;
      out.send(426,"String_Node_Str",fileName);
    }
catch (    IOException ex) {
      failure=true;
      out.send(551,"String_Node_Str",fileName);
    }
 finally {
      IoUtils.close(bis);
      IoUtils.close(bos);
    }
    if (!failure) {
      out.send(226,"String_Node_Str",fileName);
      ftpletRet=ftpletContainer.onAppendEnd(request,out);
      if (ftpletRet == FtpletEnum.RET_DISCONNECT) {
        fconfig.getConnectionManager().closeConnection(handler);
        return;
      }
    }
  }
  finally {
    request.getFtpDataConnection().closeDataSocket();
  }
}