Program: 53351
Project: 53351
Buggy source:
public List<GroupDistanceWarning> getGroupWarnings(List<String> agentIDs,List<String> sharedThingIDs) throws NotFoundException, InfosphereException, RepositoryException, ClassCastException {
  List<GroupDistanceWarning> warnings=new ArrayList<GroupDistanceWarning>();
  for (  String res_uri : sharedThingIDs) {
    RDFReactorThing thing=getResource(new URIImpl(res_uri));
    List<Resource> related_groups=thing.getAllIsRelated_as().asList();
    if ((related_groups == null) || (related_groups.isEmpty())) {
      continue;
    }
    HashedMap targetGroups=getGroupList(agentIDs);
    MapIterator it=targetGroups.mapIterator();
    while (it.hasNext()) {
      String element_key=(String)it.next();
      PersonGroup groupA=(PersonGroup)getResourceStore().get(new URIImpl(element_key),PersonGroup.class);
      List<Resource> a=groupA.getAllIsRelated_as().asList();
      if (a.contains(thing)) {
        targetGroups.remove(element_key);
      }
    }
    MapIterator it2=targetGroups.mapIterator();
    while (it2.hasNext()) {
      String target_element_key=(String)it2.next();
      URI targetURI=new URIImpl(target_element_key);
      if (getResourceStore().isTypedAs(targetURI,PIMO.PersonGroup)) {
        for (        Resource groupRes : related_groups) {
          if (getResourceStore().isTypedAs(groupRes,PIMO.PersonGroup)) {
            PersonGroup groupA=(PersonGroup)getResourceStore().get(groupRes.asURI(),PersonGroup.class);
            PersonGroup groupB=(PersonGroup)getResourceStore().get(targetURI.asURI(),PersonGroup.class);
            double distance=GroupDistanceProcessor.getGroupDistance(groupA,groupB);
            if (distance > AdvisoryConstants.MIN_GROUP_DISTANCE) {
              GroupDistanceWarning warning=new GroupDistanceWarning();
              warning.addGroup(groupRes.toString());
              warning.addResource(res_uri);
              warning.setWarningLevel(distance);
              warnings.add(warning);
            }
          }
        }
      }
    }
  }
  return warnings;
}

Fixed version (ground truth):
public List<GroupDistanceWarning> getGroupWarnings(List<String> agentIDs,List<String> sharedThingIDs) throws NotFoundException, InfosphereException, RepositoryException, ClassCastException {
  List<GroupDistanceWarning> warnings=new ArrayList<GroupDistanceWarning>();
  List<String> sharedSingleElements=new ArrayList<String>();
  for (  String res : sharedThingIDs) {
    URI resUri=new URIImpl(res);
    if (getResourceStore().isTypedAs(resUri,PPO.PrivacyPreference)) {
      sharedSingleElements.addAll(getAllItemsInDataboxAsString(resUri));
    }
 else {
      sharedSingleElements.add(res);
    }
  }
  for (  String res_uri : sharedSingleElements) {
    RDFReactorThing thing=getResource(new URIImpl(res_uri));
    List<Resource> related_groups=thing.getAllIsRelated_as().asList();
    if ((related_groups == null) || (related_groups.isEmpty())) {
      continue;
    }
    HashedMap targetGroups=getGroupList(agentIDs);
    MapIterator it=targetGroups.mapIterator();
    while (it.hasNext()) {
      String element_key=(String)it.next();
      PersonGroup groupA=(PersonGroup)getResourceStore().get(new URIImpl(element_key),PersonGroup.class);
      List<Resource> a=groupA.getAllIsRelated_as().asList();
      if (a.contains(thing)) {
        targetGroups.remove(element_key);
      }
    }
    MapIterator it2=targetGroups.mapIterator();
    while (it2.hasNext()) {
      String target_element_key=(String)it2.next();
      URI targetURI=new URIImpl(target_element_key);
      if (getResourceStore().isTypedAs(targetURI,PIMO.PersonGroup)) {
        for (        Resource groupRes : related_groups) {
          if (getResourceStore().isTypedAs(groupRes,PIMO.PersonGroup)) {
            PersonGroup groupA=(PersonGroup)getResourceStore().get(groupRes.asURI(),PersonGroup.class);
            PersonGroup groupB=(PersonGroup)getResourceStore().get(targetURI.asURI(),PersonGroup.class);
            double distance=GroupDistanceProcessor.getGroupDistance(groupA,groupB);
            if (distance > AdvisoryConstants.MIN_GROUP_DISTANCE) {
              GroupDistanceWarning warning=new GroupDistanceWarning();
              warning.addGroup(groupRes.toString());
              warning.addResource(res_uri);
              warning.setWarningLevel(distance);
              warnings.add(warning);
            }
          }
        }
      }
    }
  }
  return warnings;
}