Program: 129309
Project: 129309
Buggy source:
/** 
 * Export SchemaTarget to the specified file.
 * @param file to save
 * @param table to export
 * @return boolean result
 * @throws IOException if file cannot be saved
 * @throws ParserConfigurationException if dom is not fully respected
 */
public static boolean saveSchemaTargetToFile(File file,org.talend.core.model.metadata.builder.connection.MetadataSchema table) throws IOException, ParserConfigurationException {
  if (file != null) {
    final DocumentBuilderFactory fabrique=DocumentBuilderFactory.newInstance();
    final Bundle b=Platform.getBundle(CORE_RUNTIME_PLUGIN_ID);
    final URL url=FileLocator.toFileURL(FileLocator.find(b,new Path(TARGETSCHEMA_XSD),null));
    final File schema=new File(url.getPath());
    fabrique.setAttribute(SCHEMA_LANGUAGE,"String_Node_Str");
    fabrique.setAttribute(SCHEMA_VALIDATOR,schema);
    fabrique.setValidating(true);
    final DocumentBuilder analyseur=fabrique.newDocumentBuilder();
    analyseur.setErrorHandler(new ErrorHandler(){
      public void error(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
      public void fatalError(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
      public void warning(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
    }
);
    Document document=analyseur.newDocument();
    Element racine=document.createElement("String_Node_Str");
    document.appendChild(racine);
    for (    Object list : table.getSchemaTargets()) {
      SchemaTarget schemaTarget=(SchemaTarget)list;
      Element column=document.createElement("String_Node_Str");
      racine.appendChild(column);
      Attr xPathQuery=document.createAttribute("String_Node_Str");
      xPathQuery.setNodeValue(schemaTarget.getRelativeXPathQuery());
      column.setAttributeNode(xPathQuery);
      Attr tagName=document.createAttribute("String_Node_Str");
      tagName.setNodeValue(String.valueOf(schemaTarget.getTagName()));
      column.setAttributeNode(tagName);
    }
    XMLSerializer serializer=new XMLSerializer();
    serializer.setOutputCharStream(new java.io.FileWriter(file));
    serializer.serialize(document);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Export SchemaTarget to the specified file.
 * @param file to save
 * @param table to export
 * @return boolean result
 * @throws IOException if file cannot be saved
 * @throws ParserConfigurationException if dom is not fully respected
 */
public static boolean saveSchemaTargetToFile(File file,org.talend.core.model.metadata.builder.connection.MetadataSchema table) throws IOException, ParserConfigurationException {
  if (file != null) {
    final DocumentBuilderFactory fabrique=DocumentBuilderFactory.newInstance();
    final Bundle b=Platform.getBundle(CORE_RUNTIME_PLUGIN_ID);
    final URL url=FileLocator.toFileURL(FileLocator.find(b,new Path(TARGETSCHEMA_XSD),null));
    final File schema=new File(url.getPath());
    fabrique.setAttribute(SCHEMA_LANGUAGE,"String_Node_Str");
    fabrique.setAttribute(SCHEMA_VALIDATOR,schema);
    fabrique.setValidating(true);
    final DocumentBuilder analyseur=fabrique.newDocumentBuilder();
    analyseur.setErrorHandler(new ErrorHandler(){
      @Override public void error(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
      @Override public void fatalError(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
      @Override public void warning(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
    }
);
    Document document=analyseur.newDocument();
    Element racine=document.createElement("String_Node_Str");
    document.appendChild(racine);
    for (    Object list : table.getSchemaTargets()) {
      SchemaTarget schemaTarget=(SchemaTarget)list;
      Element column=document.createElement("String_Node_Str");
      racine.appendChild(column);
      Attr xPathQuery=document.createAttribute("String_Node_Str");
      xPathQuery.setNodeValue(schemaTarget.getRelativeXPathQuery());
      column.setAttributeNode(xPathQuery);
      Attr tagName=document.createAttribute("String_Node_Str");
      tagName.setNodeValue(String.valueOf(schemaTarget.getTagName()));
      column.setAttributeNode(tagName);
    }
    XMLSerializer serializer=new XMLSerializer();
    serializer.setOutputCharStream(new java.io.FileWriter(file));
    serializer.serialize(document);
    return true;
  }
  return false;
}