Program: 128040
Project: 128040
Buggy source:
/** 
 * Generates xml file base on inputted path, file path and an instance of <code>Document</code>
 * @param tempFolderPath
 * @param filePath
 * @param document
 */
public static void generateXMLFile(String tempFolderPath,String filePath,Document document){
  XMLWriter output=null;
  FileOutputStream out=null;
  Writer writer=null;
  try {
    out=new java.io.FileOutputStream(filePath);
    writer=new OutputStreamWriter(out,"String_Node_Str");
    OutputFormat format=OutputFormat.createPrettyPrint();
    output=new XMLWriter(writer,format){
      protected void writeDeclaration() throws IOException {
        OutputFormat formatTmp=this.getOutputFormat();
        String encoding=formatTmp.getEncoding();
        if (!formatTmp.isSuppressDeclaration()) {
          if (encoding.equals("String_Node_Str")) {
            writer.write("String_Node_Str");
            if (!formatTmp.isOmitEncoding()) {
              writer.write("String_Node_Str");
            }
            writer.write("String_Node_Str");
          }
 else {
            writer.write("String_Node_Str");
            if (!formatTmp.isOmitEncoding()) {
              writer.write("String_Node_Str" + encoding + "String_Node_Str");
            }
            writer.write("String_Node_Str");
          }
          if (formatTmp.isNewLineAfterDeclaration()) {
            println();
          }
        }
      }
    }
;
    output.write(document);
    output.flush();
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
 finally {
    if (output != null) {
      try {
        output.close();
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
    if (out != null) {
      try {
        out.close();
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates xml file base on inputted path, file path and an instance of <code>Document</code>
 * @param tempFolderPath
 * @param filePath
 * @param document
 */
public static void generateXMLFile(String tempFolderPath,String filePath,Document document){
  XMLWriter output=null;
  FileOutputStream out=null;
  Writer writer=null;
  try {
    out=new java.io.FileOutputStream(filePath);
    writer=new OutputStreamWriter(out,"String_Node_Str");
    OutputFormat format=OutputFormat.createPrettyPrint();
    output=new XMLWriter(writer,format){
      @Override protected void writeDeclaration() throws IOException {
        OutputFormat formatTmp=this.getOutputFormat();
        String encoding=formatTmp.getEncoding();
        if (!formatTmp.isSuppressDeclaration()) {
          if (encoding.equals("String_Node_Str")) {
            writer.write("String_Node_Str");
            if (!formatTmp.isOmitEncoding()) {
              writer.write("String_Node_Str");
            }
            writer.write("String_Node_Str");
          }
 else {
            writer.write("String_Node_Str");
            if (!formatTmp.isOmitEncoding()) {
              writer.write("String_Node_Str" + encoding + "String_Node_Str");
            }
            writer.write("String_Node_Str");
          }
          if (formatTmp.isNewLineAfterDeclaration()) {
            println();
          }
        }
      }
    }
;
    output.setMaximumAllowedCharacter(127);
    output.write(document);
    output.flush();
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
 finally {
    if (output != null) {
      try {
        output.close();
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
    if (out != null) {
      try {
        out.close();
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
    }
  }
}