Program: 75049
Project: 75049
Buggy source:
/** 
 * Transform the AST with given class paths, and output the result to the writer. <p> If a output directory is set with the <tt>-output</tt> command-line argument, the output is written to a Java source file with that directory as the root directory. The given writer is not used in that case.
 * @param fileName The Java file name.
 * @param ast The AST to be refactored.
 * @param writer The writer where output is written.
 * @param classPaths The class paths.
 * @param crossAnalyzedTypes The array of names of types to be added tothe visitor's cross-analyzed types list.
 * @exception IOException If IO exception occurs when reading fromthe Java file or riting to the output.
 * @exception ASTMalformedException If the Java source is illegal.
 * @see #transform(String,Writer)
 */
public static void transform(String fileName,CompilationUnit ast,Writer writer,String[] classPaths,String[] crossAnalyzedTypes) throws IOException, ASTMalformedException {
  boolean needClose=false;
  Transformer transform=new Transformer(fileName,classPaths);
  if (ast == null)   transform._parse();
 else   transform._ast=ast;
  if (crossAnalyzedTypes != null)   transform._visitor.addCrossAnalyzedTypes(crossAnalyzedTypes);
  transform._startTransform();
  if (_rootPath != null) {
    String packageName=transform._ast.getPackage().getName().toString();
    File file=new File(fileName);
    String outputFileName=file.getName();
    SourceOutputStream outputStream=SourceOutputStream.getStream(_rootPath,packageName,outputFileName,_overwrite);
    writer=new OutputStreamWriter(outputStream);
    needClose=true;
  }
  transform._outputSource(writer);
  if (needClose)   writer.close();
  if (_configName != null) {
    File file=new File(fileName);
    String simpleName=file.getName();
    if (simpleName.toUpperCase().endsWith("String_Node_Str")) {
      String baseName=simpleName.substring(0,simpleName.length() - 5);
      CompilationUnit root=(CompilationUnit)transform._ast.getRoot();
      String className;
      if (root.getPackage() != null)       className=root.getPackage().getName().toString() + "String_Node_Str" + baseName;
 else       className=baseName;
      if (_prefix != null && _prefix.length() > 0)       className=className.substring(_prefix.length() + 1);
      _classes.add(className);
    }
  }
}

Fixed version (ground truth):
/** 
 * Transform the AST with given class paths, and output the result to the writer. <p> If a output directory is set with the <tt>-output</tt> command-line argument, the output is written to a Java source file with that directory as the root directory. The given writer is not used in that case.
 * @param fileName The Java file name.
 * @param ast The AST to be refactored.
 * @param writer The writer where output is written.
 * @param classPaths The class paths.
 * @param crossAnalyzedTypes The array of names of types to be added tothe visitor's cross-analyzed types list.
 * @exception IOException If IO exception occurs when reading fromthe Java file or riting to the output.
 * @exception ASTMalformedException If the Java source is illegal.
 * @see #transform(String,Writer)
 */
public static void transform(String fileName,CompilationUnit ast,Writer writer,String[] classPaths,String[] crossAnalyzedTypes) throws IOException, ASTMalformedException {
  boolean needClose=false;
  Transformer transform=new Transformer(fileName,classPaths);
  if (ast == null)   transform._parse();
 else   transform._ast=ast;
  if (crossAnalyzedTypes != null)   transform._visitor.addCrossAnalyzedTypes(crossAnalyzedTypes);
  transform._startTransform();
  if (writer == null) {
    String packageName=transform._ast.getPackage().getName().toString();
    File file=new File(fileName);
    String outputFileName=file.getName();
    SourceOutputStream outputStream=SourceOutputStream.getStream(_rootPath,packageName,outputFileName,_overwrite);
    writer=new OutputStreamWriter(outputStream);
    needClose=true;
  }
  transform._outputSource(writer);
  if (needClose)   writer.close();
  if (_configName != null) {
    File file=new File(fileName);
    String simpleName=file.getName();
    if (simpleName.toUpperCase().endsWith("String_Node_Str")) {
      String baseName=simpleName.substring(0,simpleName.length() - 5);
      CompilationUnit root=(CompilationUnit)transform._ast.getRoot();
      String className;
      if (root.getPackage() != null)       className=root.getPackage().getName().toString() + "String_Node_Str" + baseName;
 else       className=baseName;
      if (_prefix != null && _prefix.length() > 0)       className=className.substring(_prefix.length() + 1);
      _classes.add(className);
    }
  }
}