Program: 87067
Project: 87067
Buggy source:
/** 
 * Executes commands specified as application arguments parsed by JSAP. Output is directed to System.out by default or to an output file if one is specified.  Application help, verbose help and version commands are processed  immediately. All remaining arguments are ignored. If neither of these commands are specified then the arguments are checked for an input file directive. If no input file was specified then input is pulled from System.in. Finally, all remaining commands are executed against the specified input stream.
 * @param jsap JSAP results
 * @param config JSAP configuration
 */
private static void executeCommands(JSAP jsap,JSAPResult config){
  PrintStream out=null;
  try {
    if (config.getString(Constants.ARGS_OUTPUT_FILE) != null) {
      out=openOutputFile(config.getString(Constants.ARGS_OUTPUT_FILE));
    }
 else {
      out=System.out;
    }
    if (config.getBoolean(Constants.ARGS_HELP)) {
      displayUsage(out,jsap);
      System.exit(0);
    }
 else     if (config.getBoolean(Constants.ARGS_VERBOSE_HELP)) {
      displayVerboseHelp(out,jsap);
      System.exit(0);
    }
 else     if (config.getBoolean(Constants.ARGS_VERSION)) {
      displayVersion(out);
      System.exit(0);
    }
    if (config.getString(Constants.ARGS_INPUT_FILE) == null) {
      FileParser.parse(System.in);
    }
 else {
      FileParser.parse(new File(config.getString(Constants.ARGS_INPUT_FILE)));
    }
    if (config.getBoolean(Constants.ARGS_STATISTICS_REPORT)) {
      GenericReport report=new StatisticsReport();
      out.print(report.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_SUMMARY_REPORT)) {
      GenericReport report=new SummaryReport();
      out.print(report.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_CLONE_USER)) {
      cloneUser(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_EDIT_USER)) {
      editUser(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_DELETE_USER)) {
      deleteUser(config.getString(Constants.ARGS_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_ADD_GROUPS)) {
      addGroups(config.getString(Constants.ARGS_NAME),config.getStringArray(Constants.ARGS_GROUPS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_REMOVE_GROUPS)) {
      removeGroups(config.getString(Constants.ARGS_NAME),config.getStringArray(Constants.ARGS_GROUPS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_COUNT_USERS)) {
      countUsers(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_USERS)) {
      getUsers(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_USER_GROUPS)) {
      getUserGroups(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_GET_USER_RULES)) {
      getUserRules(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_ADD_GROUP)) {
      addGroup(config.getString(Constants.ARGS_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_CLONE_GROUP)) {
      cloneGroup(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_EDIT_GROUP)) {
      editGroup(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_DELETE_GROUP)) {
      deleteGroup(config.getString(Constants.ARGS_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_ADD_MEMBERS)) {
      addMembers(config.getString(Constants.ARGS_NAME),config.getStringArray(Constants.ARGS_USERS),config.getStringArray(Constants.ARGS_GROUPS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_REMOVE_MEMBERS)) {
      removeMembers(config.getString(Constants.ARGS_NAME),config.getStringArray(Constants.ARGS_USERS),config.getStringArray(Constants.ARGS_GROUPS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_COUNT_GROUPS)) {
      countGroups(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUPS)) {
      getGroups(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUP_MEMBERS)) {
      getGroupMembers(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUP_GROUP_MEMBERS)) {
      getGroupGroupMembers(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUP_USER_MEMBERS)) {
      getGroupUserMembers(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUP_RULES)) {
      getGroupRules(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_EDIT_REPOS)) {
      editRepository(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_DELETE_REPOS)) {
      deleteRepository(config.getString(Constants.ARGS_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_COUNT_REPOS)) {
      countRepositories(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_REPOS)) {
      getRepositories(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_REPOS_RULES)) {
      getRepositoryRules(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_ADD_RULE)) {
      addRule(config.getString(Constants.ARGS_REPOS),config.getString(Constants.ARGS_PATH),config.getString(Constants.ARGS_USER),config.getString(Constants.ARGS_GROUP),config.getString(Constants.ARGS_ACCESS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_EDIT_RULE)) {
      editRule(config.getString(Constants.ARGS_REPOS),config.getString(Constants.ARGS_PATH),config.getString(Constants.ARGS_USER),config.getString(Constants.ARGS_GROUP),config.getString(Constants.ARGS_NEW_REPOS),config.getString(Constants.ARGS_NEW_PATH),config.getString(Constants.ARGS_NEW_USER),config.getString(Constants.ARGS_NEW_GROUP),config.getString(Constants.ARGS_NEW_ACCESS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_DELETE_RULE)) {
      deleteRule(config.getString(Constants.ARGS_REPOS),config.getString(Constants.ARGS_PATH),config.getString(Constants.ARGS_USER),config.getString(Constants.ARGS_GROUP));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_COUNT_RULES)) {
      countRules(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_RULES)) {
      getRules(out);
    }
    if (config.getString(Constants.ARGS_OUTPUT_FILE) != null) {
      out.close();
      out=null;
    }
  }
 catch (  Exception e) {
    System.err.println(e.getMessage());
    System.exit(1);
  }
}

Fixed version (ground truth):
/** 
 * Executes commands specified as application arguments parsed by JSAP. Output is directed to System.out by default or to an output file if one is specified.  Application help, verbose help and version commands are processed  immediately. All remaining arguments are ignored. If neither of these commands are specified then the arguments are checked for an input file directive. If no input file was specified then input is pulled from System.in. Finally, all remaining commands are executed against the specified input stream.
 * @param jsap JSAP results
 * @param config JSAP configuration
 */
private static void executeCommands(JSAP jsap,JSAPResult config){
  PrintStream out=System.out;
  try {
    if (config.getBoolean(Constants.ARGS_HELP)) {
      displayUsage(out,jsap);
      System.exit(0);
    }
 else     if (config.getBoolean(Constants.ARGS_VERBOSE_HELP)) {
      displayVerboseHelp(out,jsap);
      System.exit(0);
    }
 else     if (config.getBoolean(Constants.ARGS_VERSION)) {
      displayVersion(out);
      System.exit(0);
    }
    if (config.getString(Constants.ARGS_INPUT_FILE) == null) {
      FileParser.parse(System.in);
    }
 else {
      FileParser.parse(new File(config.getString(Constants.ARGS_INPUT_FILE)));
    }
    if (config.getString(Constants.ARGS_OUTPUT_FILE) != null) {
      out=openOutputFile(config.getString(Constants.ARGS_OUTPUT_FILE));
    }
    if (config.getBoolean(Constants.ARGS_STATISTICS_REPORT)) {
      GenericReport report=new StatisticsReport();
      out.print(report.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_SUMMARY_REPORT)) {
      GenericReport report=new SummaryReport();
      out.print(report.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_CLONE_USER)) {
      cloneUser(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_EDIT_USER)) {
      editUser(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_DELETE_USER)) {
      deleteUser(config.getString(Constants.ARGS_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_ADD_GROUPS)) {
      addGroups(config.getString(Constants.ARGS_NAME),config.getStringArray(Constants.ARGS_GROUPS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_REMOVE_GROUPS)) {
      removeGroups(config.getString(Constants.ARGS_NAME),config.getStringArray(Constants.ARGS_GROUPS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_COUNT_USERS)) {
      countUsers(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_USERS)) {
      getUsers(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_USER_GROUPS)) {
      getUserGroups(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_GET_USER_RULES)) {
      getUserRules(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_ADD_GROUP)) {
      addGroup(config.getString(Constants.ARGS_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_CLONE_GROUP)) {
      cloneGroup(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_EDIT_GROUP)) {
      editGroup(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_DELETE_GROUP)) {
      deleteGroup(config.getString(Constants.ARGS_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_ADD_MEMBERS)) {
      addMembers(config.getString(Constants.ARGS_NAME),config.getStringArray(Constants.ARGS_USERS),config.getStringArray(Constants.ARGS_GROUPS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_REMOVE_MEMBERS)) {
      removeMembers(config.getString(Constants.ARGS_NAME),config.getStringArray(Constants.ARGS_USERS),config.getStringArray(Constants.ARGS_GROUPS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_COUNT_GROUPS)) {
      countGroups(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUPS)) {
      getGroups(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUP_MEMBERS)) {
      getGroupMembers(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUP_GROUP_MEMBERS)) {
      getGroupGroupMembers(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUP_USER_MEMBERS)) {
      getGroupUserMembers(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_GET_GROUP_RULES)) {
      getGroupRules(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_EDIT_REPOS)) {
      editRepository(config.getString(Constants.ARGS_NAME),config.getString(Constants.ARGS_NEW_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_DELETE_REPOS)) {
      deleteRepository(config.getString(Constants.ARGS_NAME));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_COUNT_REPOS)) {
      countRepositories(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_REPOS)) {
      getRepositories(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_REPOS_RULES)) {
      getRepositoryRules(out,config.getString(Constants.ARGS_NAME));
    }
 else     if (config.getBoolean(Constants.ARGS_ADD_RULE)) {
      addRule(config.getString(Constants.ARGS_REPOS),config.getString(Constants.ARGS_PATH),config.getString(Constants.ARGS_USER),config.getString(Constants.ARGS_GROUP),config.getString(Constants.ARGS_ACCESS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_EDIT_RULE)) {
      editRule(config.getString(Constants.ARGS_REPOS),config.getString(Constants.ARGS_PATH),config.getString(Constants.ARGS_USER),config.getString(Constants.ARGS_GROUP),config.getString(Constants.ARGS_NEW_REPOS),config.getString(Constants.ARGS_NEW_PATH),config.getString(Constants.ARGS_NEW_USER),config.getString(Constants.ARGS_NEW_GROUP),config.getString(Constants.ARGS_NEW_ACCESS));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_DELETE_RULE)) {
      deleteRule(config.getString(Constants.ARGS_REPOS),config.getString(Constants.ARGS_PATH),config.getString(Constants.ARGS_USER),config.getString(Constants.ARGS_GROUP));
      out.print(FileGenerator.generate());
    }
 else     if (config.getBoolean(Constants.ARGS_COUNT_RULES)) {
      countRules(out);
    }
 else     if (config.getBoolean(Constants.ARGS_GET_RULES)) {
      getRules(out);
    }
    if (config.getString(Constants.ARGS_OUTPUT_FILE) != null) {
      out.close();
      out=null;
    }
  }
 catch (  Exception e) {
    System.err.println(e.getMessage());
    System.exit(1);
  }
}