Program: 129311
Project: 129311
Buggy source:
/** 
 * Initalize SchemaTargets available in a file.
 * @param file where SchemaTargets data are available
 * @return MetadataSchema setted with datas from file
 * @throws ParserConfigurationException if dom exception occured
 * @throws SAXException if sax exception occured
 * @throws IOException if file cannot be read
 */
private static List<org.talend.core.model.metadata.builder.connection.SchemaTarget> initializeSchemaTarget2(final File file) throws ParserConfigurationException, SAXException, IOException {
  final List<org.talend.core.model.metadata.builder.connection.SchemaTarget> listSchemaTargets=new ArrayList<org.talend.core.model.metadata.builder.connection.SchemaTarget>();
  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;
      }
    }
);
    final Document document=analyseur.parse(file);
    final NodeList nodes=document.getElementsByTagName("String_Node_Str");
    for (int i=0; i < nodes.getLength(); i++) {
      final org.talend.core.model.metadata.builder.connection.SchemaTarget schemaTarget=ConnectionFactory.eINSTANCE.createSchemaTarget();
      final Node nodetoParse=nodes.item(i);
      final NamedNodeMap nodeMap=nodetoParse.getAttributes();
      final Node xPathQuery=nodeMap.getNamedItem("String_Node_Str");
      final Node tagName=nodeMap.getNamedItem("String_Node_Str");
      schemaTarget.setRelativeXPathQuery(xPathQuery.getNodeValue());
      schemaTarget.setTagName(tagName.getNodeValue());
      listSchemaTargets.add(schemaTarget);
    }
  }
  return listSchemaTargets;
}

Fixed version (ground truth):
/** 
 * Initalize SchemaTargets available in a file.
 * @param file where SchemaTargets data are available
 * @return MetadataSchema setted with datas from file
 * @throws ParserConfigurationException if dom exception occured
 * @throws SAXException if sax exception occured
 * @throws IOException if file cannot be read
 */
private static List<org.talend.core.model.metadata.builder.connection.SchemaTarget> initializeSchemaTarget2(final File file) throws ParserConfigurationException, SAXException, IOException {
  final List<org.talend.core.model.metadata.builder.connection.SchemaTarget> listSchemaTargets=new ArrayList<org.talend.core.model.metadata.builder.connection.SchemaTarget>();
  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;
      }
    }
);
    final Document document=analyseur.parse(file);
    final NodeList nodes=document.getElementsByTagName("String_Node_Str");
    for (int i=0; i < nodes.getLength(); i++) {
      final org.talend.core.model.metadata.builder.connection.SchemaTarget schemaTarget=ConnectionFactory.eINSTANCE.createSchemaTarget();
      final Node nodetoParse=nodes.item(i);
      final NamedNodeMap nodeMap=nodetoParse.getAttributes();
      final Node xPathQuery=nodeMap.getNamedItem("String_Node_Str");
      final Node tagName=nodeMap.getNamedItem("String_Node_Str");
      schemaTarget.setRelativeXPathQuery(xPathQuery.getNodeValue());
      schemaTarget.setTagName(tagName.getNodeValue());
      listSchemaTargets.add(schemaTarget);
    }
  }
  return listSchemaTargets;
}