Program: 57690
Project: 57690
Buggy source:
/** 
 * <p> Converts a   {@link RecordPerspective} with an IDType that is not the{@link #recordIDType} to a new RecordPerspective with the recordIDType.</p> <p> Grouping, and naming is preserved, sample elements and trees are not. </p>
 */
public RecordPerspective convertForeignRecordPerspective(RecordPerspective foreignPerspective){
  if (foreignPerspective.getIdType().getIDCategory() != recordIDCategory) {
    throw new IllegalArgumentException("String_Node_Str" + foreignPerspective.getIdType() + "String_Node_Str"+ recordIDType);
  }
  if (foreignPerspective.getIdType() == recordIDType)   return foreignPerspective;
  RecordVirtualArray foreignRecordVA=foreignPerspective.getVirtualArray();
  RecordGroupList recordGroupList=foreignRecordVA.getGroupList();
  PerspectiveInitializationData data=new PerspectiveInitializationData();
  ArrayList<Integer> indices=new ArrayList<Integer>(foreignRecordVA.size());
  ArrayList<Integer> groupSizes=new ArrayList<Integer>(recordGroupList.size());
  ArrayList<Integer> sampleElements=new ArrayList<Integer>(recordGroupList.size());
  ArrayList<String> groupNames=new ArrayList<String>(recordGroupList.size());
  for (  Group foreignGroup : recordGroupList) {
    groupSizes.add(0);
    sampleElements.add(0);
    groupNames.add(foreignGroup.getLabel());
  }
  int count=0;
  for (  Integer foreignVAID : foreignRecordVA) {
    Integer localVAID=recordIDMappingManager.getID(foreignRecordVA.getIdType(),recordIDType,foreignVAID);
    if (localVAID == null)     continue;
    indices.add(localVAID);
    int groupIndex=recordGroupList.getGroupOfVAIndex(foreignRecordVA.indexOf(foreignVAID)).getGroupIndex();
    groupSizes.set(groupIndex,groupSizes.get(groupIndex) + 1);
    sampleElements.set(groupIndex,count);
    count++;
  }
  data.setData(indices,groupSizes,sampleElements,groupNames);
  RecordPerspective localRecordPerspective=new RecordPerspective(this);
  localRecordPerspective.setIDType(recordIDType);
  localRecordPerspective.init(data);
  localRecordPerspective.setLabel(foreignPerspective.getLabel(),foreignPerspective.isDefaultLabel());
  return localRecordPerspective;
}

Fixed version (ground truth):
/** 
 * <p> Converts a   {@link RecordPerspective} with an IDType that is not the{@link #recordIDType} to a new RecordPerspective with the recordIDType.</p> <p> Grouping, and naming is preserved, sample elements and trees are not. </p>
 */
public RecordPerspective convertForeignRecordPerspective(RecordPerspective foreignPerspective){
  if (foreignPerspective.getIdType().getIDCategory() != recordIDCategory) {
    throw new IllegalArgumentException("String_Node_Str" + foreignPerspective.getIdType() + "String_Node_Str"+ recordIDType);
  }
  if (foreignPerspective.getIdType() == recordIDType)   return foreignPerspective;
  RecordVirtualArray foreignRecordVA=foreignPerspective.getVirtualArray();
  RecordGroupList recordGroupList=foreignRecordVA.getGroupList();
  PerspectiveInitializationData data=new PerspectiveInitializationData();
  ArrayList<Integer> indices=new ArrayList<Integer>(foreignRecordVA.size());
  ArrayList<Integer> groupSizes=new ArrayList<Integer>(recordGroupList.size());
  ArrayList<Integer> sampleElements=new ArrayList<Integer>(recordGroupList.size());
  ArrayList<String> groupNames=new ArrayList<String>(recordGroupList.size());
  for (  Group foreignGroup : recordGroupList) {
    groupSizes.add(0);
    sampleElements.add(0);
    groupNames.add(foreignGroup.getLabel());
  }
  int count=0;
  for (  Integer foreignVAID : foreignRecordVA) {
    Set<Integer> localVAIDS=recordIDMappingManager.getIDAsSet(foreignRecordVA.getIdType(),recordIDType,foreignVAID);
    for (    Integer localVAID : localVAIDS) {
      if (localVAID == null)       continue;
      indices.add(localVAID);
      int groupIndex=recordGroupList.getGroupOfVAIndex(foreignRecordVA.indexOf(foreignVAID)).getGroupIndex();
      groupSizes.set(groupIndex,groupSizes.get(groupIndex) + 1);
      sampleElements.set(groupIndex,count);
      count++;
    }
  }
  data.setData(indices,groupSizes,sampleElements,groupNames);
  RecordPerspective localRecordPerspective=new RecordPerspective(this);
  localRecordPerspective.setIDType(recordIDType);
  localRecordPerspective.init(data);
  localRecordPerspective.setLabel(foreignPerspective.getLabel(),foreignPerspective.isDefaultLabel());
  return localRecordPerspective;
}