Program: 152313
Project: 152313
Buggy source:
/** 
 * Execute command
 */
public void execute(Connection connection,FtpRequest request,FtpSessionImpl session,FtpReplyOutput out) throws IOException, FtpException {
  try {
    session.resetState();
    out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_150_FILE_STATUS_OKAY,"String_Node_Str",null));
    DataConnection dataConnection;
    try {
      dataConnection=session.getDataConnection().openConnection();
    }
 catch (    Exception e) {
      LOG.debug("String_Node_Str",e);
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION,"String_Node_Str",null));
      return;
    }
    boolean failure=false;
    try {
      ListArgument parsedArg=ListArgumentParser.parse(request.getArgument());
      FileFormater formater;
      if (parsedArg.hasOption('l')) {
        formater=LIST_FILE_FORMATER;
      }
 else {
        formater=NLST_FILE_FORMATER;
      }
      dataConnection.transferToClient(directoryLister.listFiles(parsedArg,session.getFileSystemView(),formater));
    }
 catch (    SocketException ex) {
      LOG.debug("String_Node_Str",ex);
      failure=true;
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED,"String_Node_Str",null));
    }
catch (    IOException ex) {
      LOG.debug("String_Node_Str",ex);
      failure=true;
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN,"String_Node_Str",null));
    }
catch (    IllegalArgumentException e) {
      LOG.debug("String_Node_Str" + request.getArgument(),e);
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,"String_Node_Str",null));
    }
    if (!failure) {
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_226_CLOSING_DATA_CONNECTION,"String_Node_Str",null));
    }
  }
  finally {
    session.getDataConnection().closeDataConnection();
  }
}

Fixed version (ground truth):
/** 
 * Execute command
 */
public void execute(Connection connection,FtpRequest request,FtpSessionImpl session,FtpReplyOutput out) throws IOException, FtpException {
  try {
    session.resetState();
    DataConnectionFactory connFactory=session.getDataConnection();
    if (connFactory instanceof IODataConnectionFactory) {
      InetAddress address=((IODataConnectionFactory)connFactory).getInetAddress();
      if (address == null) {
        out.write(new DefaultFtpReply(FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS,"String_Node_Str"));
        return;
      }
    }
    out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_150_FILE_STATUS_OKAY,"String_Node_Str",null));
    DataConnection dataConnection;
    try {
      dataConnection=session.getDataConnection().openConnection();
    }
 catch (    Exception e) {
      LOG.debug("String_Node_Str",e);
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION,"String_Node_Str",null));
      return;
    }
    boolean failure=false;
    try {
      ListArgument parsedArg=ListArgumentParser.parse(request.getArgument());
      FileFormater formater;
      if (parsedArg.hasOption('l')) {
        formater=LIST_FILE_FORMATER;
      }
 else {
        formater=NLST_FILE_FORMATER;
      }
      dataConnection.transferToClient(directoryLister.listFiles(parsedArg,session.getFileSystemView(),formater));
    }
 catch (    SocketException ex) {
      LOG.debug("String_Node_Str",ex);
      failure=true;
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED,"String_Node_Str",null));
    }
catch (    IOException ex) {
      LOG.debug("String_Node_Str",ex);
      failure=true;
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN,"String_Node_Str",null));
    }
catch (    IllegalArgumentException e) {
      LOG.debug("String_Node_Str" + request.getArgument(),e);
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,"String_Node_Str",null));
    }
    if (!failure) {
      out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_226_CLOSING_DATA_CONNECTION,"String_Node_Str",null));
    }
  }
  finally {
    session.getDataConnection().closeDataConnection();
  }
}