Program: 128209
Project: 128209
Buggy source:
public static MetadataColumnsAndDbmsId<org.talend.core.model.metadata.builder.connection.MetadataColumn> loadMetadataColumnsAndDbmsIdFromFile(final File file) throws ParserConfigurationException, SAXException, IOException {
  final List<org.talend.core.model.metadata.builder.connection.MetadataColumn> listColumns=new ArrayList<org.talend.core.model.metadata.builder.connection.MetadataColumn>();
  String dbmsId=null;
  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(SCHEMA_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);
    dbmsId=document.getDocumentElement().getAttribute("String_Node_Str");
    final NodeList nodes=document.getElementsByTagName("String_Node_Str");
    Set<String> columnsAlreadyAdded=new HashSet<String>();
    for (int i=0; i < nodes.getLength(); i++) {
      final org.talend.core.model.metadata.builder.connection.MetadataColumn metadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
      final Node nodetoParse=nodes.item(i);
      final NamedNodeMap nodeMap=nodetoParse.getAttributes();
      final Node label=nodeMap.getNamedItem("String_Node_Str");
      final Node key=nodeMap.getNamedItem("String_Node_Str");
      final Node type=nodeMap.getNamedItem("String_Node_Str");
      final Node sourceType=nodeMap.getNamedItem("String_Node_Str");
      final Node length=nodeMap.getNamedItem("String_Node_Str");
      final Node precision=nodeMap.getNamedItem("String_Node_Str");
      final Node nullable=nodeMap.getNamedItem("String_Node_Str");
      final Node defaultValue=nodeMap.getNamedItem("String_Node_Str");
      final Node comment=nodeMap.getNamedItem("String_Node_Str");
      final Node pattern=nodeMap.getNamedItem("String_Node_Str");
      final Node originalLength=nodeMap.getNamedItem("String_Node_Str");
      final Node originalField=nodeMap.getNamedItem("String_Node_Str");
      final Node impliedDecimal=nodeMap.getNamedItem("String_Node_Str");
      final Node signed=nodeMap.getNamedItem("String_Node_Str");
      String nodeValue=MetadataToolHelper.validateColumnName(label.getNodeValue(),0);
      metadataColumn.setLabel(nodeValue);
      UniqueStringGenerator<org.talend.core.model.metadata.builder.connection.MetadataColumn> uniqueLabelGenerator=new UniqueStringGenerator<org.talend.core.model.metadata.builder.connection.MetadataColumn>(metadataColumn.getLabel(),listColumns){
        @Override protected String getBeanString(        org.talend.core.model.metadata.builder.connection.MetadataColumn bean){
          return bean.getLabel();
        }
      }
;
      metadataColumn.setLabel(uniqueLabelGenerator.getUniqueString());
      metadataColumn.setKey(Boolean.parseBoolean(key.getNodeValue()));
      metadataColumn.setTalendType(getNewTalendType(type.getNodeValue()));
      if (sourceType != null) {
        metadataColumn.setSourceType(sourceType.getNodeValue());
      }
      if (length.getNodeValue() != null) {
        try {
          metadataColumn.setLength(Integer.parseInt(length.getNodeValue()));
        }
 catch (        final NumberFormatException e) {
          metadataColumn.setLength(0);
        }
      }
 else {
        metadataColumn.setLength(0);
      }
      if (precision.getNodeValue() != null) {
        try {
          metadataColumn.setPrecision(Integer.parseInt(precision.getNodeValue()));
        }
 catch (        final NumberFormatException e) {
          metadataColumn.setPrecision(0);
        }
      }
 else {
        metadataColumn.setPrecision(0);
      }
      metadataColumn.setNullable(Boolean.parseBoolean(nullable.getNodeValue()));
      metadataColumn.setDefaultValue(defaultValue.getNodeValue());
      metadataColumn.setComment(comment.getNodeValue());
      if (originalLength != null && originalLength.getNodeValue() != null) {
        try {
          metadataColumn.setOriginalLength(Integer.parseInt(originalLength.getNodeValue()));
        }
 catch (        final NumberFormatException e) {
          metadataColumn.setOriginalLength(0);
        }
      }
      if (pattern.getNodeValue() != null) {
        metadataColumn.setPattern(pattern.getNodeValue());
      }
      if (originalField.getNodeValue() != null) {
        String originalFieldValue=MetadataToolHelper.validateColumnName(originalField.getNodeValue(),0);
        metadataColumn.setOriginalField(originalFieldValue);
      }
 else {
        metadataColumn.setOriginalField(metadataColumn.getLabel());
      }
      if (!columnsAlreadyAdded.contains(metadataColumn.getLabel())) {
        listColumns.add(metadataColumn);
        columnsAlreadyAdded.add(metadataColumn.getLabel());
      }
      if (impliedDecimal != null && impliedDecimal.getNodeValue() != null) {
        TaggedValue impliedDc=TaggedValueHelper.createTaggedValue("String_Node_Str" + impliedDecimal.getNodeName(),impliedDecimal.getNodeValue());
        metadataColumn.getTaggedValue().add(impliedDc);
      }
      if (signed != null && signed.getNodeValue() != null) {
        TaggedValue sign=TaggedValueHelper.createTaggedValue("String_Node_Str" + signed.getNodeName(),signed.getNodeValue());
        metadataColumn.getTaggedValue().add(sign);
      }
    }
  }
  return new MetadataColumnsAndDbmsId<org.talend.core.model.metadata.builder.connection.MetadataColumn>(listColumns,dbmsId);
}

Fixed version (ground truth):
public static MetadataColumnsAndDbmsId<org.talend.core.model.metadata.builder.connection.MetadataColumn> loadMetadataColumnsAndDbmsIdFromFile(final File file) throws ParserConfigurationException, SAXException, IOException {
  final List<org.talend.core.model.metadata.builder.connection.MetadataColumn> listColumns=new ArrayList<org.talend.core.model.metadata.builder.connection.MetadataColumn>();
  String dbmsId=null;
  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(SCHEMA_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);
    dbmsId=document.getDocumentElement().getAttribute("String_Node_Str");
    final NodeList nodes=document.getElementsByTagName("String_Node_Str");
    Set<String> columnsAlreadyAdded=new HashSet<String>();
    for (int i=0; i < nodes.getLength(); i++) {
      final org.talend.core.model.metadata.builder.connection.MetadataColumn metadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
      final Node nodetoParse=nodes.item(i);
      final NamedNodeMap nodeMap=nodetoParse.getAttributes();
      final Node label=nodeMap.getNamedItem("String_Node_Str");
      final Node key=nodeMap.getNamedItem("String_Node_Str");
      final Node type=nodeMap.getNamedItem("String_Node_Str");
      final Node sourceType=nodeMap.getNamedItem("String_Node_Str");
      final Node length=nodeMap.getNamedItem("String_Node_Str");
      final Node precision=nodeMap.getNamedItem("String_Node_Str");
      final Node nullable=nodeMap.getNamedItem("String_Node_Str");
      final Node defaultValue=nodeMap.getNamedItem("String_Node_Str");
      final Node comment=nodeMap.getNamedItem("String_Node_Str");
      final Node pattern=nodeMap.getNamedItem("String_Node_Str");
      final Node originalLength=nodeMap.getNamedItem("String_Node_Str");
      final Node originalField=nodeMap.getNamedItem("String_Node_Str");
      final Node impliedDecimal=nodeMap.getNamedItem("String_Node_Str");
      final Node signed=nodeMap.getNamedItem("String_Node_Str");
      String nodeValue=MetadataToolHelper.validateColumnName(label.getNodeValue(),0);
      metadataColumn.setLabel(nodeValue);
      UniqueStringGenerator<org.talend.core.model.metadata.builder.connection.MetadataColumn> uniqueLabelGenerator=new UniqueStringGenerator<org.talend.core.model.metadata.builder.connection.MetadataColumn>(metadataColumn.getLabel(),listColumns){
        @Override protected String getBeanString(        org.talend.core.model.metadata.builder.connection.MetadataColumn bean){
          return bean.getLabel();
        }
      }
;
      metadataColumn.setLabel(uniqueLabelGenerator.getUniqueString());
      metadataColumn.setKey(Boolean.parseBoolean(key.getNodeValue()));
      metadataColumn.setTalendType(getNewTalendType(type.getNodeValue()));
      if (sourceType != null) {
        metadataColumn.setSourceType(sourceType.getNodeValue());
      }
      if (length.getNodeValue() != null) {
        try {
          metadataColumn.setLength(Integer.parseInt(length.getNodeValue()));
        }
 catch (        final NumberFormatException e) {
          metadataColumn.setLength(0);
        }
      }
 else {
        metadataColumn.setLength(0);
      }
      if (precision.getNodeValue() != null) {
        try {
          metadataColumn.setPrecision(Integer.parseInt(precision.getNodeValue()));
        }
 catch (        final NumberFormatException e) {
          metadataColumn.setPrecision(0);
        }
      }
 else {
        metadataColumn.setPrecision(0);
      }
      metadataColumn.setNullable(Boolean.parseBoolean(nullable.getNodeValue()));
      metadataColumn.setDefaultValue(defaultValue.getNodeValue());
      metadataColumn.setComment(comment.getNodeValue());
      if (originalLength != null && originalLength.getNodeValue() != null) {
        try {
          metadataColumn.setOriginalLength(Integer.parseInt(originalLength.getNodeValue()));
        }
 catch (        final NumberFormatException e) {
          metadataColumn.setOriginalLength(0);
        }
      }
      if (pattern.getNodeValue() != null) {
        metadataColumn.setPattern(pattern.getNodeValue());
      }
      if (originalField.getNodeValue() != null) {
        metadataColumn.setOriginalField(originalField.getNodeValue());
      }
 else {
        metadataColumn.setOriginalField(metadataColumn.getLabel());
      }
      if (!columnsAlreadyAdded.contains(metadataColumn.getLabel())) {
        listColumns.add(metadataColumn);
        columnsAlreadyAdded.add(metadataColumn.getLabel());
      }
      if (impliedDecimal != null && impliedDecimal.getNodeValue() != null) {
        TaggedValue impliedDc=TaggedValueHelper.createTaggedValue("String_Node_Str" + impliedDecimal.getNodeName(),impliedDecimal.getNodeValue());
        metadataColumn.getTaggedValue().add(impliedDc);
      }
      if (signed != null && signed.getNodeValue() != null) {
        TaggedValue sign=TaggedValueHelper.createTaggedValue("String_Node_Str" + signed.getNodeName(),signed.getNodeValue());
        metadataColumn.getTaggedValue().add(sign);
      }
    }
  }
  return new MetadataColumnsAndDbmsId<org.talend.core.model.metadata.builder.connection.MetadataColumn>(listColumns,dbmsId);
}