Program: 56912
Project: 56912
Buggy source:
@Override protected void parseFile(BufferedReader reader) throws IOException {
  GeneralManager.get().getSplash().updateProgessLabel("String_Node_Str" + targetIDType);
  float progressBarFactor=100f / numberOfLinesInFile;
  IDSpecification idSpecification=groupingSpecifications.getRowIDSpecification();
  IDType sourceIDType=IDType.getIDType(idSpecification.getIdType());
  IDTypeParsingRules parsingRules=null;
  if (idSpecification.getIdTypeParsingRules() != null)   parsingRules=idSpecification.getIdTypeParsingRules();
 else   if (sourceIDType.getIdTypeParsingRules() != null)   parsingRules=sourceIDType.getIdTypeParsingRules();
  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(IStatus.INFO,this.toString(),"String_Node_Str"));
    return;
  }
  try {
    String[] headerCells=null;
    if (groupingSpecifications.isContainsColumnIDs()) {
      reader=loader.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=loader.getResource(groupingSpecifications.getDataSourcePath());
    for (int headerLineCounter=0; headerLineCounter < groupingSpecifications.getNumberOfHeaderLines(); headerLineCounter++) {
      reader.readLine();
    }
    ArrayList<Integer> columnsToRead=groupingSpecifications.getColumns();
    String firstDataLine=null;
    if (columnsToRead == null || headerCells == null) {
      firstDataLine=reader.readLine();
      String[] data=firstDataLine.split(groupingSpecifications.getDelimiter());
      if (columnsToRead == null) {
        columnsToRead=new ArrayList<Integer>(data.length);
        for (int columnCount=1; columnCount < data.length; columnCount++) {
          columnsToRead.add(columnCount);
        }
      }
      if (headerCells == null) {
        headerCells=new String[data.length];
        for (int columnCount=0; columnCount < data.length; columnCount++) {
          headerCells[columnCount]=DEFAULT_GROUP_NAME;
        }
      }
    }
    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 columnNumber : columnsToRead) {
      currentGroupList=new ArrayList<Pair<String,ArrayList<Integer>>>();
      listOfGroupLists.add(currentGroupList);
      listOfGroupNames.add(headerCells[columnNumber]);
    }
    int lineCounter=0;
    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,parsingRules);
      Integer mappedID=idMappingManager.getID(sourceIDType,targetIDType,originalID);
      if (mappedID == null) {
        Logger.log(new Status(IStatus.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++;
      }
      lineCounter++;
      if (lineCounter % 100 == 0) {
        GeneralManager.get().getSplash().updateProgress((int)(progressBarFactor * lineCounter));
      }
    }
    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);
      String groupLabel=listOfGroupNames.get(groupListCount);
      if (groupLabel.equals(DEFAULT_GROUP_NAME)) {
        if (groupingSpecifications.getGroupingName() != null) {
          groupLabel=clusterSizes.size() + "String_Node_Str" + groupingSpecifications.getGroupingName();
        }
 else {
          groupLabel=clusterSizes.size() + "String_Node_Str";
        }
      }
      data.setLabel(groupLabel);
      perspectiveInitializationDatas.add(data);
    }
  }
 catch (  IOException ioException) {
    throw new IllegalStateException("String_Node_Str" + groupingSpecifications.getDataSourcePath());
  }
}

Fixed version (ground truth):
@Override protected void parseFile(BufferedReader reader) throws IOException {
  GeneralManager.get().updateProgressLabel("String_Node_Str" + targetIDType);
  float progressBarFactor=100f / numberOfLinesInFile;
  IDSpecification idSpecification=groupingSpecifications.getRowIDSpecification();
  IDType sourceIDType=IDType.getIDType(idSpecification.getIdType());
  IDTypeParsingRules parsingRules=null;
  if (idSpecification.getIdTypeParsingRules() != null)   parsingRules=idSpecification.getIdTypeParsingRules();
 else   if (sourceIDType.getIdTypeParsingRules() != null)   parsingRules=sourceIDType.getIdTypeParsingRules();
  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(IStatus.INFO,this.toString(),"String_Node_Str"));
    return;
  }
  try {
    String[] headerCells=null;
    if (groupingSpecifications.isContainsColumnIDs()) {
      reader=loader.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=loader.getResource(groupingSpecifications.getDataSourcePath());
    for (int headerLineCounter=0; headerLineCounter < groupingSpecifications.getNumberOfHeaderLines(); headerLineCounter++) {
      reader.readLine();
    }
    ArrayList<Integer> columnsToRead=groupingSpecifications.getColumns();
    String firstDataLine=null;
    if (columnsToRead == null || headerCells == null) {
      firstDataLine=reader.readLine();
      String[] data=firstDataLine.split(groupingSpecifications.getDelimiter());
      if (columnsToRead == null) {
        columnsToRead=new ArrayList<Integer>(data.length);
        for (int columnCount=1; columnCount < data.length; columnCount++) {
          columnsToRead.add(columnCount);
        }
      }
      if (headerCells == null) {
        headerCells=new String[data.length];
        for (int columnCount=0; columnCount < data.length; columnCount++) {
          headerCells[columnCount]=DEFAULT_GROUP_NAME;
        }
      }
    }
    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 columnNumber : columnsToRead) {
      currentGroupList=new ArrayList<Pair<String,ArrayList<Integer>>>();
      listOfGroupLists.add(currentGroupList);
      listOfGroupNames.add(headerCells[columnNumber]);
    }
    int lineCounter=0;
    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,parsingRules);
      Integer mappedID=idMappingManager.getID(sourceIDType,targetIDType,originalID);
      if (mappedID == null) {
        Logger.log(new Status(IStatus.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++;
      }
      lineCounter++;
      if (lineCounter % 100 == 0) {
        GeneralManager.get().updateProgress((int)(progressBarFactor * lineCounter));
      }
    }
    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);
      String groupLabel=listOfGroupNames.get(groupListCount);
      if (groupLabel.equals(DEFAULT_GROUP_NAME)) {
        if (groupingSpecifications.getGroupingName() != null) {
          groupLabel=clusterSizes.size() + "String_Node_Str" + groupingSpecifications.getGroupingName();
        }
 else {
          groupLabel=clusterSizes.size() + "String_Node_Str";
        }
      }
      data.setLabel(groupLabel);
      perspectiveInitializationDatas.add(data);
    }
  }
 catch (  IOException ioException) {
    throw new IllegalStateException("String_Node_Str" + groupingSpecifications.getDataSourcePath());
  }
}