Program: 69678
Project: 69678
Buggy source:
private List<CheckListAssessmentRow> loadDatas(){
  if (!(userCourseEnv instanceof UserCourseEnvironmentImpl)) {
    return Collections.emptyList();
  }
  UserCourseEnvironmentImpl env=(UserCourseEnvironmentImpl)userCourseEnv;
  List<Checkbox> checkboxColl=checkboxList.getList();
  int numOfCheckbox=checkboxList.getNumOfCheckbox();
  List<SecurityGroup> secGroups=new ArrayList<SecurityGroup>();
  Map<Long,Long> groupToSecGroupKey=new HashMap<Long,Long>();
  RepositoryEntry re=env.getCourseRepositoryEntry();
  boolean courseTutor=securityManager.isIdentityInSecurityGroup(getIdentity(),re.getTutorGroup());
  Set<Long> missingIdentityKeys=new HashSet<>();
  if (courseTutor) {
    secGroups.add(re.getParticipantGroup());
    List<RepositoryEntryMembership> repoMemberships=repositoryManager.getRepositoryEntryMembership(re);
    for (    RepositoryEntryMembership repoMembership : repoMemberships) {
      if (repoMembership.getParticipantRepoKey() == null)       continue;
      missingIdentityKeys.add(repoMembership.getIdentityKey());
    }
  }
  List<BusinessGroup> coachedGroups=env.getCoachedGroups();
  for (  BusinessGroup group : coachedGroups) {
    secGroups.add(group.getPartipiciantGroup());
    groupToSecGroupKey.put(group.getKey(),group.getPartipiciantGroup().getKey());
  }
  List<AssessmentData> dataList=checkboxManager.getAssessmentDatas(courseOres,courseNode.getIdent(),secGroups);
  List<CheckListAssessmentRow> boxList=getAssessmentDataViews(dataList,checkboxColl);
  Map<Long,CheckListAssessmentRow> identityToView=new HashMap<>();
  for (  CheckListAssessmentRow box : boxList) {
    identityToView.put(box.getIdentityKey(),box);
    missingIdentityKeys.remove(box.getIdentityKey());
  }
  List<BusinessGroupMembership> memberships=businessGroupService.getBusinessGroupsMembership(coachedGroups);
  for (  BusinessGroupMembership membership : memberships) {
    if (!membership.isParticipant())     continue;
    Long identityKey=membership.getIdentityKey();
    if (!identityToView.containsKey(identityKey)) {
      missingIdentityKeys.add(identityKey);
    }
  }
  List<Identity> missingIdentities=securityManager.loadIdentityByKeys(missingIdentityKeys);
  for (  Identity missingIdentity : missingIdentities) {
    Boolean[] checked=new Boolean[numOfCheckbox];
    Float[] scores=new Float[numOfCheckbox];
    CheckListAssessmentRow view=new CheckListAssessmentRow(missingIdentity,checked,scores,null,userPropertyHandlers,getLocale());
    identityToView.put(missingIdentity.getKey(),view);
  }
  for (  BusinessGroupMembership membership : memberships) {
    if (!membership.isParticipant())     continue;
    CheckListAssessmentRow view=identityToView.get(membership.getIdentityKey());
    if (view != null) {
      view.addGroupKey(membership.getGroupKey());
    }
  }
  List<CheckListAssessmentRow> views=new ArrayList<>();
  views.addAll(identityToView.values());
  return views;
}

Fixed version (ground truth):
private List<CheckListAssessmentRow> loadDatas(){
  if (!(userCourseEnv instanceof UserCourseEnvironmentImpl)) {
    return Collections.emptyList();
  }
  UserCourseEnvironmentImpl env=(UserCourseEnvironmentImpl)userCourseEnv;
  List<Checkbox> checkboxColl=checkboxList.getList();
  int numOfCheckbox=checkboxList.getNumOfCheckbox();
  boolean courseAdmin=env.isAdmin();
  List<SecurityGroup> secGroups=new ArrayList<SecurityGroup>();
  Map<Long,Long> groupToSecGroupKey=new HashMap<Long,Long>();
  RepositoryEntry re=env.getCourseRepositoryEntry();
  boolean courseTutor=securityManager.isIdentityInSecurityGroup(getIdentity(),re.getTutorGroup());
  Set<Long> missingIdentityKeys=new HashSet<>();
  if (courseTutor || courseAdmin) {
    secGroups.add(re.getParticipantGroup());
    List<RepositoryEntryMembership> repoMemberships=repositoryManager.getRepositoryEntryMembership(re);
    for (    RepositoryEntryMembership repoMembership : repoMemberships) {
      if (repoMembership.getParticipantRepoKey() == null)       continue;
      missingIdentityKeys.add(repoMembership.getIdentityKey());
    }
  }
  List<BusinessGroup> coachedGroups=courseAdmin ? userCourseEnv.getCourseEnvironment().getCourseGroupManager().getAllBusinessGroups() : env.getCoachedGroups();
  for (  BusinessGroup group : coachedGroups) {
    secGroups.add(group.getPartipiciantGroup());
    groupToSecGroupKey.put(group.getKey(),group.getPartipiciantGroup().getKey());
  }
  List<AssessmentData> dataList=checkboxManager.getAssessmentDatas(courseOres,courseNode.getIdent(),secGroups);
  List<CheckListAssessmentRow> boxList=getAssessmentDataViews(dataList,checkboxColl);
  Map<Long,CheckListAssessmentRow> identityToView=new HashMap<>();
  for (  CheckListAssessmentRow box : boxList) {
    identityToView.put(box.getIdentityKey(),box);
    missingIdentityKeys.remove(box.getIdentityKey());
  }
  List<BusinessGroupMembership> memberships=businessGroupService.getBusinessGroupsMembership(coachedGroups);
  for (  BusinessGroupMembership membership : memberships) {
    if (!membership.isParticipant())     continue;
    Long identityKey=membership.getIdentityKey();
    if (!identityToView.containsKey(identityKey)) {
      missingIdentityKeys.add(identityKey);
    }
  }
  List<Identity> missingIdentities=securityManager.loadIdentityByKeys(missingIdentityKeys);
  for (  Identity missingIdentity : missingIdentities) {
    Boolean[] checked=new Boolean[numOfCheckbox];
    Float[] scores=new Float[numOfCheckbox];
    CheckListAssessmentRow view=new CheckListAssessmentRow(missingIdentity,checked,scores,null,userPropertyHandlers,getLocale());
    identityToView.put(missingIdentity.getKey(),view);
  }
  for (  BusinessGroupMembership membership : memberships) {
    if (!membership.isParticipant())     continue;
    CheckListAssessmentRow view=identityToView.get(membership.getIdentityKey());
    if (view != null) {
      view.addGroupKey(membership.getGroupKey());
    }
  }
  List<CheckListAssessmentRow> views=new ArrayList<>();
  views.addAll(identityToView.values());
  return views;
}