Program: 57700
Project: 57700
Buggy source:
public ArrayList<PerspectiveInitializationData> parseGrouping(IDType targetIDType){
  IDSpecification idSpecification=groupingSpecifications.getRowIDSpecification();
  IDType sourceIDType=IDType.getIDType(idSpecification.getIdType());
  if (!sourceIDType.getIDCategory().equals(targetIDType.getIDCategory()))   throw new IllegalArgumentException("String_Node_Str" + sourceIDType + "String_Node_Str"+ targetIDType);
  IDMappingManager idMappingManager=IDMappingManagerRegistry.get().getIDMappingManager(sourceIDType.getIDCategory());
  if (groupingSpecifications.getDataSourcePath() == null) {
    Logger.log(new Status(Status.INFO,this.toString(),"String_Node_Str"));
    return null;
  }
  BufferedReader reader;
  try {
    String[] headerCells=null;
    if (groupingSpecifications.isContainsColumnIDs()) {
      reader=GeneralManager.get().getResourceLoader().getResource(groupingSpecifications.getDataSourcePath());
      String headerLine="String_Node_Str";
      int rowOfColumnIDs=(groupingSpecifications.getRowOfColumnIDs() != null) ? groupingSpecifications.getRowOfColumnIDs() : groupingSpecifications.getNumberOfHeaderLines() - 1;
      for (int countToHeader=0; countToHeader <= rowOfColumnIDs; countToHeader++) {
        headerLine=reader.readLine();
      }
      headerCells=headerLine.split(groupingSpecifications.getDelimiter(),-1);
      reader.close();
    }
    reader=GeneralManager.get().getResourceLoader().getResource(groupingSpecifications.getDataSourcePath());
    for (int headerLineCounter=0; headerLineCounter < groupingSpecifications.getNumberOfHeaderLines(); headerLineCounter++) {
      reader.readLine();
    }
    ArrayList<Integer> columnsToRead=groupingSpecifications.getColumns();
    String firstDataLine=null;
    if (columnsToRead == null) {
      firstDataLine=reader.readLine();
      String[] data=firstDataLine.split(groupingSpecifications.getDelimiter());
      columnsToRead=new ArrayList<Integer>(data.length);
      if (headerCells == null) {
        headerCells=new String[data.length];
      }
      for (int columnCount=1; columnCount < data.length; columnCount++) {
        columnsToRead.add(columnCount);
        headerCells[columnCount]="String_Node_Str" + columnCount;
      }
    }
    ArrayList<ArrayList<Pair<String,ArrayList<Integer>>>> listOfGroupLists=new ArrayList<ArrayList<Pair<String,ArrayList<Integer>>>>(columnsToRead.size());
    ArrayList<String> listOfGroupNames=new ArrayList<String>(columnsToRead.size());
    ArrayList<Pair<String,ArrayList<Integer>>> currentGroupList;
    for (    Integer columnCount : columnsToRead) {
      currentGroupList=new ArrayList<Pair<String,ArrayList<Integer>>>();
      listOfGroupLists.add(currentGroupList);
      listOfGroupNames.add(headerCells[columnCount]);
    }
    while (true) {
      String line=null;
      if (firstDataLine == null) {
        line=reader.readLine();
      }
 else {
        line=firstDataLine;
        firstDataLine=null;
      }
      if (line == null)       break;
      String[] columns=line.split(groupingSpecifications.getDelimiter());
      String originalID=columns[groupingSpecifications.getColumnOfRowIds()];
      originalID=convertID(originalID,idSpecification);
      Integer mappedID=idMappingManager.getID(sourceIDType,targetIDType,originalID);
      if (mappedID == null) {
        Logger.log(new Status(Status.WARNING,this.toString(),"String_Node_Str" + originalID));
        continue;
      }
      int groupListCounter=0;
      for (      Integer columnID : columnsToRead) {
        currentGroupList=listOfGroupLists.get(groupListCounter);
        ArrayList<Integer> group=null;
        for (        Pair<String,ArrayList<Integer>> groupPair : currentGroupList) {
          if (groupPair.getFirst().equals(columns[columnID]))           group=groupPair.getSecond();
        }
        if (group == null) {
          group=new ArrayList<Integer>();
          currentGroupList.add(new Pair<String,ArrayList<Integer>>(columns[columnID],group));
        }
        group.add(mappedID);
        groupListCounter++;
      }
    }
    reader.close();
    ArrayList<PerspectiveInitializationData> perspectiveInitializationDatas=new ArrayList<PerspectiveInitializationData>();
    for (int groupListCount=0; groupListCount < listOfGroupLists.size(); groupListCount++) {
      ArrayList<Pair<String,ArrayList<Integer>>> groupList=listOfGroupLists.get(groupListCount);
      ArrayList<Integer> sortedIDs=new ArrayList<Integer>();
      ArrayList<Integer> clusterSizes=new ArrayList<Integer>(groupList.size());
      ArrayList<Integer> sampleElements=new ArrayList<Integer>(groupList.size());
      ArrayList<String> clusterNames=new ArrayList<String>(groupList.size());
      int sampleIndex=0;
      for (      Pair<String,ArrayList<Integer>> groupPair : groupList) {
        ArrayList<Integer> group=groupPair.getSecond();
        sortedIDs.addAll(group);
        clusterSizes.add(group.size());
        clusterNames.add(groupPair.getFirst());
        sampleElements.add(sampleIndex);
        sampleIndex+=group.size();
      }
      PerspectiveInitializationData data=new PerspectiveInitializationData();
      data.setData(sortedIDs,clusterSizes,sampleElements,clusterNames);
      data.setLabel(listOfGroupNames.get(groupListCount));
      perspectiveInitializationDatas.add(data);
    }
    return perspectiveInitializationDatas;
  }
 catch (  IOException ioException) {
    throw new IllegalStateException("String_Node_Str" + groupingSpecifications.getDataSourcePath());
  }
}

Fixed version (ground truth):
public ArrayList<PerspectiveInitializationData> parseGrouping(IDType targetIDType){
  IDSpecification idSpecification=groupingSpecifications.getRowIDSpecification();
  IDType sourceIDType=IDType.getIDType(idSpecification.getIdType());
  if (!sourceIDType.getIDCategory().equals(targetIDType.getIDCategory()))   throw new IllegalArgumentException("String_Node_Str" + sourceIDType + "String_Node_Str"+ targetIDType);
  IDMappingManager idMappingManager=IDMappingManagerRegistry.get().getIDMappingManager(sourceIDType.getIDCategory());
  if (groupingSpecifications.getDataSourcePath() == null) {
    Logger.log(new Status(Status.INFO,this.toString(),"String_Node_Str"));
    return null;
  }
  BufferedReader reader;
  try {
    String[] headerCells=null;
    if (groupingSpecifications.isContainsColumnIDs()) {
      reader=GeneralManager.get().getResourceLoader().getResource(groupingSpecifications.getDataSourcePath());
      String headerLine="String_Node_Str";
      int rowOfColumnIDs=(groupingSpecifications.getRowOfColumnIDs() != null) ? groupingSpecifications.getRowOfColumnIDs() : groupingSpecifications.getNumberOfHeaderLines() - 1;
      for (int countToHeader=0; countToHeader <= rowOfColumnIDs; countToHeader++) {
        headerLine=reader.readLine();
      }
      headerCells=headerLine.split(groupingSpecifications.getDelimiter(),-1);
      reader.close();
    }
    reader=GeneralManager.get().getResourceLoader().getResource(groupingSpecifications.getDataSourcePath());
    for (int headerLineCounter=0; headerLineCounter < groupingSpecifications.getNumberOfHeaderLines(); headerLineCounter++) {
      reader.readLine();
    }
    ArrayList<Integer> columnsToRead=groupingSpecifications.getColumns();
    String firstDataLine=null;
    if (columnsToRead == null) {
      firstDataLine=reader.readLine();
      String[] data=firstDataLine.split(groupingSpecifications.getDelimiter());
      columnsToRead=new ArrayList<Integer>(data.length);
      if (headerCells == null) {
        headerCells=new String[data.length];
        for (int columnCount=1; columnCount < data.length; columnCount++) {
          headerCells[columnCount]="String_Node_Str" + columnCount;
        }
      }
      for (int columnCount=1; columnCount < data.length; columnCount++) {
        columnsToRead.add(columnCount);
      }
    }
    ArrayList<ArrayList<Pair<String,ArrayList<Integer>>>> listOfGroupLists=new ArrayList<ArrayList<Pair<String,ArrayList<Integer>>>>(columnsToRead.size());
    ArrayList<String> listOfGroupNames=new ArrayList<String>(columnsToRead.size());
    ArrayList<Pair<String,ArrayList<Integer>>> currentGroupList;
    for (    Integer columnCount : columnsToRead) {
      currentGroupList=new ArrayList<Pair<String,ArrayList<Integer>>>();
      listOfGroupLists.add(currentGroupList);
      listOfGroupNames.add(headerCells[columnCount]);
    }
    while (true) {
      String line=null;
      if (firstDataLine == null) {
        line=reader.readLine();
      }
 else {
        line=firstDataLine;
        firstDataLine=null;
      }
      if (line == null)       break;
      String[] columns=line.split(groupingSpecifications.getDelimiter());
      String originalID=columns[groupingSpecifications.getColumnOfRowIds()];
      originalID=convertID(originalID,idSpecification);
      Integer mappedID=idMappingManager.getID(sourceIDType,targetIDType,originalID);
      if (mappedID == null) {
        Logger.log(new Status(Status.WARNING,this.toString(),"String_Node_Str" + originalID));
        continue;
      }
      int groupListCounter=0;
      for (      Integer columnID : columnsToRead) {
        currentGroupList=listOfGroupLists.get(groupListCounter);
        ArrayList<Integer> group=null;
        for (        Pair<String,ArrayList<Integer>> groupPair : currentGroupList) {
          if (groupPair.getFirst().equals(columns[columnID]))           group=groupPair.getSecond();
        }
        if (group == null) {
          group=new ArrayList<Integer>();
          currentGroupList.add(new Pair<String,ArrayList<Integer>>(columns[columnID],group));
        }
        group.add(mappedID);
        groupListCounter++;
      }
    }
    reader.close();
    ArrayList<PerspectiveInitializationData> perspectiveInitializationDatas=new ArrayList<PerspectiveInitializationData>();
    for (int groupListCount=0; groupListCount < listOfGroupLists.size(); groupListCount++) {
      ArrayList<Pair<String,ArrayList<Integer>>> groupList=listOfGroupLists.get(groupListCount);
      ArrayList<Integer> sortedIDs=new ArrayList<Integer>();
      ArrayList<Integer> clusterSizes=new ArrayList<Integer>(groupList.size());
      ArrayList<Integer> sampleElements=new ArrayList<Integer>(groupList.size());
      ArrayList<String> clusterNames=new ArrayList<String>(groupList.size());
      int sampleIndex=0;
      for (      Pair<String,ArrayList<Integer>> groupPair : groupList) {
        ArrayList<Integer> group=groupPair.getSecond();
        sortedIDs.addAll(group);
        clusterSizes.add(group.size());
        clusterNames.add(groupPair.getFirst());
        sampleElements.add(sampleIndex);
        sampleIndex+=group.size();
      }
      PerspectiveInitializationData data=new PerspectiveInitializationData();
      data.setData(sortedIDs,clusterSizes,sampleElements,clusterNames);
      data.setLabel(listOfGroupNames.get(groupListCount));
      perspectiveInitializationDatas.add(data);
    }
    return perspectiveInitializationDatas;
  }
 catch (  IOException ioException) {
    throw new IllegalStateException("String_Node_Str" + groupingSpecifications.getDataSourcePath());
  }
}