Program: 118265
Project: 118265
Buggy source:
public void initModel(){
  List<? extends IConnection> incomingConnections=NodeUtil.getIncomingConnections(hl7Component,IConnectionCategory.FLOW);
  List<Map<String,String>> maps=(List<Map<String,String>>)ElementParameterParser.getObjectValue(hl7Component,"String_Node_Str");
  List<String> schemaList=new ArrayList<String>();
  for (  IMetadataTable table : hl7Component.getMetadataList()) {
    if (table.getLabel() != null) {
      schemaList.add(table.getLabel());
    }
  }
  List<Map<String,String>> rootTable=hl7Component.getTableList(HL7InputComponent.ROOT);
  Map<String,IMetadataTable> schemaNameToInputTable=new HashMap<String,IMetadataTable>();
  if (!maps.isEmpty()) {
    for (    Map<String,String> map : maps) {
      String schemaName=map.get("String_Node_Str");
      int first=schemaName.indexOf("String_Node_Str");
      int second=schemaName.lastIndexOf("String_Node_Str");
      if (first > 0 && first < second) {
        schemaName=schemaName.substring(first + 1,second);
      }
      IMetadataTable metadataTable=null;
      for (      IConnection connection : incomingConnections) {
        if (connection.getUniqueName().equals(map.get("String_Node_Str"))) {
          metadataTable=connection.getMetadataTable();
          metadataTable.setLabel(connection.getUniqueName());
          schemaNameToInputTable.put(schemaName,metadataTable);
          break;
        }
      }
    }
  }
 else {
    for (    String schemaName : schemaList) {
      IMetadataTable metadataTable=null;
      for (      IConnection connection : incomingConnections) {
        if (connection.getUniqueName().equals(schemaName)) {
          metadataTable=connection.getMetadataTable();
          metadataTable.setLabel(connection.getUniqueName());
          schemaNameToInputTable.put(schemaName,metadataTable);
        }
      }
    }
  }
  Map<String,HL7TreeNode> mapNodes=new HashMap<String,HL7TreeNode>();
  treeData=new ArrayList<HL7TreeNode>();
  HL7TreeNode rootNode=null;
  HL7TreeNode current=null;
  HL7TreeNode temp=null;
  String currentPath=null;
  String defaultValue=null;
  int nodeOrder=0;
  boolean haveOrder=true;
  for (  Map<String,String> rootMap : rootTable) {
    String newPath=rootMap.get(HL7InputComponent.PATH);
    String columnName=rootMap.get(HL7InputComponent.COLUMN);
    defaultValue=rootMap.get(HL7InputComponent.VALUE);
    String orderValue=rootMap.get(HL7InputComponent.ORDER);
    boolean repeatable=Boolean.valueOf(rootMap.get("String_Node_Str"));
    if (orderValue == null || "String_Node_Str".equals(orderValue)) {
      haveOrder=false;
    }
    String rowName=columnName;
    if (columnName != null && columnName.contains("String_Node_Str")) {
      String[] names=columnName.split("String_Node_Str");
      rowName=names[0];
      columnName=names[1];
    }
 else {
      columnName=null;
    }
    temp=this.addElement(current,currentPath,newPath,defaultValue,mapNodes);
    if (temp == null) {
      continue;
    }
    if (rootNode == null) {
      rootNode=temp;
    }
    if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("String_Node_Str")) {
      temp.setMain(true);
    }
    current=temp;
    currentPath=newPath;
    if (haveOrder) {
      temp.setOrder(nodeOrder);
    }
    if (rowName != null && rowName.length() > 0) {
      temp.setRow(rowName);
    }
    if (columnName != null) {
      IMetadataTable metadataTable=schemaNameToInputTable.get(rowName);
      if (metadataTable == null) {
        IMetadataTable metadataTableTemp=null;
        for (        IConnection connection : incomingConnections) {
          metadataTableTemp=connection.getMetadataTable();
          String connectionName=metadataTableTemp.getLabel();
          if (connectionName == null) {
            connectionName=connection.getUniqueName();
          }
          if (columnName.startsWith(connectionName)) {
            break;
          }
        }
        temp.setColumnName(columnName);
        if (metadataTableTemp != null) {
          temp.setColumn(metadataTableTemp.getColumn(columnName));
          temp.setTable(metadataTableTemp);
        }
      }
 else {
        temp.setColumnName(columnName);
        temp.setColumn(metadataTable.getColumn(columnName));
        temp.setTable(metadataTable);
      }
    }
  }
  if (rootNode == null) {
    rootNode=new Element("String_Node_Str");
  }
  if (haveOrder) {
    orderNode(rootNode);
  }
  if (rootNode.getRow() != null) {
    rootNode.setRow(null);
  }
  treeData.add(rootNode);
  contents.put(rootNode.getColumnLabel(),treeData);
  initCurrentSchema();
}

Fixed version (ground truth):
public void initModel(){
  List<? extends IConnection> incomingConnections=NodeUtil.getIncomingConnections(hl7Component,IConnectionCategory.FLOW);
  List<Map<String,String>> maps=(List<Map<String,String>>)ElementParameterParser.getObjectValue(hl7Component,"String_Node_Str");
  List<String> schemaList=new ArrayList<String>();
  for (  IMetadataTable table : hl7Component.getMetadataList()) {
    if (table.getLabel() != null) {
      schemaList.add(table.getLabel());
    }
  }
  List<Map<String,String>> rootTable=hl7Component.getTableList(HL7InputComponent.ROOT);
  Map<String,IMetadataTable> schemaNameToInputTable=new HashMap<String,IMetadataTable>();
  if (!maps.isEmpty()) {
    for (    Map<String,String> map : maps) {
      String schemaName=map.get("String_Node_Str");
      int first=schemaName.indexOf("String_Node_Str");
      int second=schemaName.lastIndexOf("String_Node_Str");
      if (first > 0 && first < second) {
        schemaName=schemaName.substring(first + 1,second);
      }
      IMetadataTable metadataTable=null;
      for (      IConnection connection : incomingConnections) {
        if (connection.getUniqueName().equals(map.get("String_Node_Str"))) {
          metadataTable=connection.getMetadataTable();
          metadataTable.setLabel(connection.getUniqueName());
          schemaNameToInputTable.put(schemaName,metadataTable);
          break;
        }
      }
    }
  }
 else {
    for (    String schemaName : schemaList) {
      IMetadataTable metadataTable=null;
      for (      IConnection connection : incomingConnections) {
        if (connection.getUniqueName().equals(schemaName)) {
          metadataTable=connection.getMetadataTable();
          metadataTable.setLabel(connection.getUniqueName());
          schemaNameToInputTable.put(schemaName,metadataTable);
        }
      }
    }
  }
  Map<String,HL7TreeNode> mapNodes=new HashMap<String,HL7TreeNode>();
  treeData=new ArrayList<HL7TreeNode>();
  HL7TreeNode rootNode=null;
  HL7TreeNode current=null;
  HL7TreeNode temp=null;
  String currentPath=null;
  String defaultValue=null;
  int nodeOrder=0;
  boolean haveOrder=true;
  for (  Map<String,String> rootMap : rootTable) {
    String newPath=rootMap.get(HL7InputComponent.PATH);
    String columnName=rootMap.get(HL7InputComponent.COLUMN);
    defaultValue=rootMap.get(HL7InputComponent.VALUE);
    String orderValue=rootMap.get(HL7InputComponent.ORDER);
    boolean repeatable=Boolean.valueOf(rootMap.get("String_Node_Str"));
    if (orderValue == null || "String_Node_Str".equals(orderValue)) {
      haveOrder=false;
    }
    String rowName=columnName;
    if (columnName != null && columnName.contains("String_Node_Str")) {
      String[] names=columnName.split("String_Node_Str");
      rowName=names[0];
      columnName=names[1];
    }
 else {
      columnName=null;
    }
    temp=this.addElement(current,currentPath,newPath,defaultValue,mapNodes);
    if (temp == null) {
      continue;
    }
    if (rootNode == null) {
      rootNode=temp;
    }
    if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("String_Node_Str")) {
      temp.setMain(true);
    }
    current=temp;
    currentPath=newPath;
    temp.setRepetable(repeatable);
    if (haveOrder) {
      temp.setOrder(nodeOrder);
    }
    if (rowName != null && rowName.length() > 0) {
      temp.setRow(rowName);
    }
    if (columnName != null) {
      IMetadataTable metadataTable=schemaNameToInputTable.get(rowName);
      if (metadataTable == null) {
        IMetadataTable metadataTableTemp=null;
        for (        IConnection connection : incomingConnections) {
          metadataTableTemp=connection.getMetadataTable();
          String connectionName=metadataTableTemp.getLabel();
          if (connectionName == null) {
            connectionName=connection.getUniqueName();
          }
          if (columnName.startsWith(connectionName)) {
            break;
          }
        }
        temp.setColumnName(columnName);
        if (metadataTableTemp != null) {
          temp.setColumn(metadataTableTemp.getColumn(columnName));
          temp.setTable(metadataTableTemp);
        }
      }
 else {
        temp.setColumnName(columnName);
        temp.setColumn(metadataTable.getColumn(columnName));
        temp.setTable(metadataTable);
      }
    }
  }
  if (rootNode == null) {
    rootNode=new Element("String_Node_Str");
  }
  if (haveOrder) {
    orderNode(rootNode);
  }
  if (rootNode.getRow() != null) {
    rootNode.setRow(null);
  }
  treeData.add(rootNode);
  contents.put(rootNode.getColumnLabel(),treeData);
  initCurrentSchema();
}