Program: 188720
Project: 188720
Buggy source:
public static PreservationEventViewBundle retrievePreservationEventViewBundle(String eventId) throws NotFoundException, GenericException {
  PreservationEventViewBundle eventBundle=new PreservationEventViewBundle();
  Map<String,IndexedAIP> aips=new HashMap<String,IndexedAIP>();
  Map<String,IndexedRepresentation> representations=new HashMap<String,IndexedRepresentation>();
  Map<String,IndexedFile> files=new HashMap<String,IndexedFile>();
  Map<String,TransferredResource> transferredResources=new HashMap<String,TransferredResource>();
  IndexedPreservationEvent ipe=RodaCoreFactory.getIndexService().retrieve(IndexedPreservationEvent.class,eventId);
  eventBundle.setEvent(ipe);
  if (ipe.getLinkingAgentIds() != null && !ipe.getLinkingAgentIds().isEmpty()) {
    Map<String,IndexedPreservationAgent> agents=new HashMap<String,IndexedPreservationAgent>();
    for (    LinkingIdentifier agentID : ipe.getLinkingAgentIds()) {
      try {
        IndexedPreservationAgent agent=RodaCoreFactory.getIndexService().retrieve(IndexedPreservationAgent.class,agentID.getValue());
        agents.put(agentID.getValue(),agent);
      }
 catch (      NotFoundException|GenericException e) {
        LOGGER.error("String_Node_Str" + agentID + "String_Node_Str"+ e.getMessage());
      }
    }
    eventBundle.setAgents(agents);
  }
  List<LinkingIdentifier> allLinkingIdentifiers=new ArrayList<>();
  if (ipe.getSourcesObjectIds() != null) {
    allLinkingIdentifiers.addAll(ipe.getSourcesObjectIds());
  }
  if (ipe.getOutcomeObjectIds() != null) {
    allLinkingIdentifiers.addAll(ipe.getOutcomeObjectIds());
  }
  for (  LinkingIdentifier identifier : allLinkingIdentifiers) {
    String idValue=identifier.getValue();
    LinkingObjectType linkingType=LinkingObjectUtils.getLinkingIdentifierType(idValue);
    try {
      if (LinkingObjectType.AIP.equals(linkingType)) {
        String uuid=LinkingObjectUtils.getAipIdFromLinkingId(idValue);
        IndexedAIP aip=retrieve(IndexedAIP.class,uuid);
        aips.put(idValue,aip);
      }
 else       if (LinkingObjectType.REPRESENTATION.equals(linkingType)) {
        String uuid=LinkingObjectUtils.getRepresentationIdFromLinkingId(idValue);
        IndexedRepresentation rep=retrieve(IndexedRepresentation.class,uuid);
        representations.put(idValue,rep);
      }
 else       if (LinkingObjectType.FILE.equals(linkingType)) {
        IndexedFile file=retrieve(IndexedFile.class,LinkingObjectUtils.getFileIdFromLinkingId(idValue));
        files.put(idValue,file);
      }
 else       if (LinkingObjectType.TRANSFERRED_RESOURCE.equals(linkingType)) {
        String uuid=LinkingObjectUtils.getTransferredResourceIdFromLinkingId(idValue);
        TransferredResource tr=retrieve(TransferredResource.class,uuid);
        transferredResources.put(idValue,tr);
      }
 else {
        LOGGER.warn("String_Node_Str" + linkingType);
      }
    }
 catch (    NotFoundException e) {
    }
  }
  eventBundle.setAips(aips);
  eventBundle.setRepresentations(representations);
  eventBundle.setFiles(files);
  eventBundle.setTransferredResources(transferredResources);
  return eventBundle;
}

Fixed version (ground truth):
public static PreservationEventViewBundle retrievePreservationEventViewBundle(String eventId) throws NotFoundException, GenericException {
  PreservationEventViewBundle eventBundle=new PreservationEventViewBundle();
  Map<String,IndexedAIP> aips=new HashMap<String,IndexedAIP>();
  Map<String,IndexedRepresentation> representations=new HashMap<String,IndexedRepresentation>();
  Map<String,IndexedFile> files=new HashMap<String,IndexedFile>();
  Map<String,TransferredResource> transferredResources=new HashMap<String,TransferredResource>();
  IndexedPreservationEvent ipe=RodaCoreFactory.getIndexService().retrieve(IndexedPreservationEvent.class,eventId);
  eventBundle.setEvent(ipe);
  if (ipe.getLinkingAgentIds() != null && !ipe.getLinkingAgentIds().isEmpty()) {
    Map<String,IndexedPreservationAgent> agents=new HashMap<String,IndexedPreservationAgent>();
    for (    LinkingIdentifier agentID : ipe.getLinkingAgentIds()) {
      try {
        IndexedPreservationAgent agent=RodaCoreFactory.getIndexService().retrieve(IndexedPreservationAgent.class,agentID.getValue());
        agents.put(agentID.getValue(),agent);
      }
 catch (      NotFoundException|GenericException e) {
        LOGGER.error("String_Node_Str" + agentID + "String_Node_Str"+ e.getMessage());
      }
    }
    eventBundle.setAgents(agents);
  }
  List<LinkingIdentifier> allLinkingIdentifiers=new ArrayList<>();
  if (ipe.getSourcesObjectIds() != null) {
    allLinkingIdentifiers.addAll(ipe.getSourcesObjectIds());
  }
  if (ipe.getOutcomeObjectIds() != null) {
    allLinkingIdentifiers.addAll(ipe.getOutcomeObjectIds());
  }
  for (  LinkingIdentifier identifier : allLinkingIdentifiers) {
    String idValue=identifier.getValue();
    LinkingObjectType linkingType=LinkingObjectUtils.getLinkingIdentifierType(idValue);
    try {
      if (LinkingObjectType.AIP.equals(linkingType)) {
        String uuid=LinkingObjectUtils.getAipIdFromLinkingId(idValue);
        IndexedAIP aip=retrieve(IndexedAIP.class,uuid);
        aips.put(idValue,aip);
      }
 else       if (LinkingObjectType.REPRESENTATION.equals(linkingType)) {
        String uuid=LinkingObjectUtils.getRepresentationIdFromLinkingId(idValue);
        IndexedRepresentation rep=retrieve(IndexedRepresentation.class,uuid);
        representations.put(idValue,rep);
      }
 else       if (LinkingObjectType.FILE.equals(linkingType)) {
        IndexedFile file=retrieve(IndexedFile.class,LinkingObjectUtils.getFileIdFromLinkingId(idValue));
        files.put(idValue,file);
      }
 else       if (LinkingObjectType.TRANSFERRED_RESOURCE.equals(linkingType)) {
        String id=LinkingObjectUtils.getTransferredResourceIdFromLinkingId(idValue);
        String uuid=UUID.nameUUIDFromBytes(id.getBytes()).toString();
        TransferredResource tr=retrieve(TransferredResource.class,uuid);
        transferredResources.put(idValue,tr);
      }
 else {
        LOGGER.warn("String_Node_Str" + linkingType);
      }
    }
 catch (    NotFoundException e) {
    }
  }
  eventBundle.setAips(aips);
  eventBundle.setRepresentations(representations);
  eventBundle.setFiles(files);
  eventBundle.setTransferredResources(transferredResources);
  return eventBundle;
}