Program: 20640
Project: 20640
Buggy source:
public static boolean writeChangeLog(File file,SimpleClearCaseChangeLogSet set,TaskListener listener) throws IOException {
  DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
  Document doc;
  try {
    doc=factory.newDocumentBuilder().newDocument();
  }
 catch (  ParserConfigurationException ex) {
    DebugHelper.error(listener,"String_Node_Str",ex.getMessage());
    return false;
  }
  doc.setXmlVersion(XML_VERSION);
  Element changelog=doc.createElement(CHANGELOG);
  for (  SimpleClearCaseChangeLogEntry e : set.getEntries()) {
    Element entry=doc.createElement(ENTRY);
    Element date=doc.createElement(DATE);
    date.setTextContent(DateUtil.formatDate(e.getDate()));
    Element user=doc.createElement(USER);
    user.setTextContent(e.getUser());
    Element comment=doc.createElement(COMMENT);
    comment.setTextContent(e.getComment());
    Element version=doc.createElement(VERSION);
    version.setTextContent(e.getVersion());
    Element operation=doc.createElement(OPERATION);
    operation.setTextContent(e.getOperation());
    Element eventDescription=doc.createElement(EVENT_DESCRIPTION);
    eventDescription.setTextContent(e.getEventDescription());
    Element items=doc.createElement(ITEMS);
    for (    String filePath : e.getAffectedPaths()) {
      Element item=doc.createElement(ITEM);
      item.setTextContent(filePath);
      items.appendChild(item);
    }
    entry.appendChild(date);
    entry.appendChild(user);
    entry.appendChild(operation);
    entry.appendChild(eventDescription);
    entry.appendChild(version);
    entry.appendChild(comment);
    entry.appendChild(items);
    changelog.appendChild(entry);
  }
  doc.appendChild(changelog);
  TransformerFactory tf=TransformerFactory.newInstance();
  Transformer t;
  try {
    t=tf.newTransformer();
    t.setOutputProperty(OutputKeys.ENCODING,XML_ENCODING);
    t.setOutputProperty(OutputKeys.INDENT,XML_INDENT);
    t.setOutputProperty(XML_INDENT_SPACE_SETTING,XML_INDENT_SPACE);
    DOMSource src=new DOMSource(doc);
    StreamResult res=new StreamResult(new PrintWriter(new FileWriter(file)));
    t.transform(src,res);
  }
 catch (  TransformerException ex) {
    DebugHelper.error(listener,"String_Node_Str",ex.getMessage());
    return false;
  }
  return true;
}

Fixed version (ground truth):
public static boolean writeChangeLog(File file,SimpleClearCaseChangeLogSet set,TaskListener listener) throws IOException {
  DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
  Document doc;
  try {
    doc=factory.newDocumentBuilder().newDocument();
  }
 catch (  ParserConfigurationException ex) {
    DebugHelper.error(listener,"String_Node_Str",ex.getMessage());
    return false;
  }
  doc.setXmlVersion(XML_VERSION);
  Element changelog=doc.createElement(CHANGELOG);
  for (  SimpleClearCaseChangeLogEntry e : set.getEntries()) {
    Element entry=doc.createElement(ENTRY);
    Element date=doc.createElement(DATE);
    date.setTextContent(DateUtil.formatDate(e.getDate()));
    Element user=doc.createElement(USER);
    user.setTextContent(e.getUser());
    Element comment=doc.createElement(COMMENT);
    comment.setTextContent(e.getComment());
    Element version=doc.createElement(VERSION);
    version.setTextContent(e.getVersion());
    Element operation=doc.createElement(OPERATION);
    operation.setTextContent(e.getOperation());
    Element eventDescription=doc.createElement(EVENT_DESCRIPTION);
    eventDescription.setTextContent(e.getEventDescription());
    Element items=doc.createElement(ITEMS);
    for (    String filePath : e.getAffectedPaths()) {
      Element item=doc.createElement(ITEM);
      item.setTextContent(filePath);
      items.appendChild(item);
    }
    entry.appendChild(date);
    entry.appendChild(user);
    entry.appendChild(operation);
    entry.appendChild(eventDescription);
    entry.appendChild(version);
    entry.appendChild(comment);
    entry.appendChild(items);
    changelog.appendChild(entry);
  }
  doc.appendChild(changelog);
  TransformerFactory tf=TransformerFactory.newInstance();
  Transformer t;
  try {
    t=tf.newTransformer();
    t.setOutputProperty(OutputKeys.ENCODING,XML_ENCODING);
    t.setOutputProperty(OutputKeys.INDENT,XML_INDENT);
    t.setOutputProperty(XML_INDENT_SPACE_SETTING,XML_INDENT_SPACE);
    DOMSource src=new DOMSource(doc);
    StreamResult res=new StreamResult(new FileOutputStream(file));
    t.transform(src,res);
  }
 catch (  TransformerException ex) {
    DebugHelper.error(listener,"String_Node_Str",ex.getMessage());
    return false;
  }
  return true;
}