Program: 75091
Project: 75091
Buggy source:
/** 
 * Transform a set of files into backtracking-enabled ones. The set of files is given by an array of strings as their names, or the names of the directories that contain them. If a string in the array is a file name, it is refactored and the output is printed out; if it is the name of a directory, all Java files in the directory and its sub-directories are looked up and refactored in the same way.
 * @param args The array of file names or names of directories.
 * @exception Exception If any exception occues.
 */
public static void main(String[] args) throws Exception {
  boolean outputResult=true;
  if (args.length == 0)   _printUsage();
 else {
    String[] paths=PathFinder.getPtClassPaths();
    Writer standardWriter=outputResult ? new OutputStreamWriter(System.out) : null;
    int start=0;
    while (start < args.length) {
      int newPosition=_parseArguments(args,start);
      if (newPosition != start)       start=newPosition;
 else       break;
    }
    if (_extraClassPaths != null) {
      String[] morePaths=new String[paths.length + _extraClassPaths.length];
      System.arraycopy(paths,0,morePaths,0,paths.length);
      System.arraycopy(_extraClassPaths,0,morePaths,paths.length,_extraClassPaths.length);
      paths=morePaths;
    }
    List fileList=new LinkedList();
    List crossAnalysis=new LinkedList();
    for (int i=start; i < args.length; i++) {
      String pathOrFile=args[i];
      File[] files;
      if (pathOrFile.startsWith("String_Node_Str")) {
        String listName=pathOrFile.substring(1);
        BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(listName)));
        List strings=new LinkedList();
        String line=reader.readLine();
        while (line != null) {
          strings.add(line);
          line=reader.readLine();
        }
        files=new File[strings.size()];
        Iterator stringsIter=strings.iterator();
        for (int j=0; stringsIter.hasNext(); j++)         files[j]=new File((String)stringsIter.next());
      }
 else       files=PathFinder.getJavaFiles(pathOrFile,true);
      ClassFileLoader loader=new ClassFileLoader();
      for (int j=0; j < files.length; j++) {
        String fileName=files[j].getPath();
        if (fileName.endsWith("String_Node_Str"))         fileName=fileName.substring(0,fileName.length() - 5) + "String_Node_Str";
 else {
          System.err.println("String_Node_Str" + files[j] + "String_Node_Str"+ "String_Node_Str");
          continue;
        }
        Class c=null;
        try {
          c=loader.loadClass(new File(fileName));
        }
 catch (        Exception e) {
          System.err.println("String_Node_Str" + files[j] + "String_Node_Str"+ "String_Node_Str"+ e.getMessage());
          continue;
        }
        fileList.add(files[j]);
        crossAnalysis.add(c.getName());
      }
    }
    String[] crossAnalyzedTypes=new String[crossAnalysis.size()];
    Iterator crossAnalysisIter=crossAnalysis.iterator();
    for (int i=0; crossAnalysisIter.hasNext(); i++)     crossAnalyzedTypes[i]=(String)crossAnalysisIter.next();
    Iterator filesIter=fileList.iterator();
    while (filesIter.hasNext()) {
      File file=(File)filesIter.next();
      String fileName=file.getPath();
      System.err.println("String_Node_Str" + fileName + "String_Node_Str");
      transform(file.getPath(),standardWriter,paths,crossAnalyzedTypes);
      if (outputResult)       standardWriter.flush();
    }
    _outputConfig();
    if (outputResult)     standardWriter.close();
  }
}

Fixed version (ground truth):
/** 
 * Transform a set of files into backtracking-enabled ones. The set of files is given by an array of strings as their names, or the names of the directories that contain them. If a string in the array is a file name, it is refactored and the output is printed out; if it is the name of a directory, all Java files in the directory and its sub-directories are looked up and refactored in the same way.
 * @param args The array of file names or names of directories.
 * @exception Exception If any exception occues.
 */
public static void main(String[] args) throws Exception {
  boolean outputResult=true;
  if (args.length == 0)   _printUsage();
 else {
    String[] paths=PathFinder.getPtClassPaths();
    Writer standardWriter=outputResult ? new OutputStreamWriter(System.out) : null;
    int start=0;
    while (start < args.length) {
      int newPosition=_parseArguments(args,start);
      if (newPosition != start)       start=newPosition;
 else       break;
    }
    if (_extraClassPaths != null) {
      String[] morePaths=new String[paths.length + _extraClassPaths.length];
      System.arraycopy(paths,0,morePaths,0,paths.length);
      System.arraycopy(_extraClassPaths,0,morePaths,paths.length,_extraClassPaths.length);
      paths=morePaths;
    }
    List fileList=new LinkedList();
    Set crossAnalysis=new HashSet();
    for (int i=start; i < args.length; i++) {
      String pathOrFile=args[i];
      File[] files;
      if (pathOrFile.startsWith("String_Node_Str")) {
        String listName=pathOrFile.substring(1);
        BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(listName)));
        List strings=new LinkedList();
        String line=reader.readLine();
        while (line != null) {
          strings.add(line);
          line=reader.readLine();
        }
        files=new File[strings.size()];
        Iterator stringsIter=strings.iterator();
        for (int j=0; stringsIter.hasNext(); j++)         files[j]=new File((String)stringsIter.next());
      }
 else       files=PathFinder.getJavaFiles(pathOrFile,true);
      ClassFileLoader loader=new ClassFileLoader();
      for (int j=0; j < files.length; j++) {
        String fileName=files[j].getPath();
        if (fileName.endsWith("String_Node_Str"))         fileName=fileName.substring(0,fileName.length() - 5) + "String_Node_Str";
 else {
          System.err.println("String_Node_Str" + files[j] + "String_Node_Str"+ "String_Node_Str");
          continue;
        }
        Class c=null;
        try {
          c=loader.loadClass(new File(fileName));
        }
 catch (        Exception e) {
          System.err.println("String_Node_Str" + files[j] + "String_Node_Str"+ "String_Node_Str"+ e.getMessage());
          continue;
        }
        fileList.add(files[j]);
        crossAnalysis.add(c.getName());
        _addInnerClasses(crossAnalysis,fileName,c.getPackage() == null ? null : c.getPackage().getName());
      }
    }
    String[] crossAnalyzedTypes=new String[crossAnalysis.size()];
    Iterator crossAnalysisIter=crossAnalysis.iterator();
    for (int i=0; crossAnalysisIter.hasNext(); i++)     crossAnalyzedTypes[i]=(String)crossAnalysisIter.next();
    Iterator filesIter=fileList.iterator();
    while (filesIter.hasNext()) {
      File file=(File)filesIter.next();
      String fileName=file.getPath();
      System.err.println("String_Node_Str" + fileName + "String_Node_Str");
      transform(file.getPath(),standardWriter,paths,crossAnalyzedTypes);
      if (outputResult)       standardWriter.flush();
    }
    _outputConfig();
    if (outputResult)     standardWriter.close();
  }
}