Program: 40952
Project: 40952
Buggy source:
/** 
 */
public Response getPlanInstances(final String plan,final UriInfo uriInfo,final CSARID csarId,final QName serviceTemplate,final Long serviceTemplateInstanceId,final PlanTypes... planTypes){
  if (!hasPlan(csarId,planTypes,plan)) {
    logger.info("String_Node_Str" + plan + "String_Node_Str");
    throw new NotFoundException("String_Node_Str" + plan + "String_Node_Str");
  }
  ServiceTemplateInstanceRepository repo=new ServiceTemplateInstanceRepository();
  final Collection<ServiceTemplateInstance> serviceInstances;
  if (serviceTemplateInstanceId != null) {
    serviceInstances=Lists.newArrayList();
    serviceInstances.add(repo.find(serviceTemplateInstanceId).get());
  }
 else {
    serviceInstances=repo.findByCsarId(csarId);
  }
  final List<PlanInstanceDTO> planInstances=Lists.newArrayList();
  for (  ServiceTemplateInstance sti : serviceInstances) {
    List<PlanInstanceDTO> foo=sti.getPlanInstances().stream().filter(p -> Arrays.asList(planTypes).contains(PlanTypes.isPlanTypeURI(p.getType().toString()))).map(p -> PlanInstanceDTO.Converter.convert(p)).collect(Collectors.toList());
    planInstances.addAll(foo);
  }
  for (  final PlanInstanceDTO pi : planInstances) {
    final Long id=pi.getServiceTemplateInstanceId();
    if (id != null) {
      final URI uri=uriInfo.getBaseUriBuilder().path("String_Node_Str").build(csarId.toString(),serviceTemplate.toString(),String.valueOf(id));
      pi.add(Link.fromUri(UriUtil.encode(uri)).rel("String_Node_Str").build());
    }
    pi.add(UriUtil.generateSubResourceLink(uriInfo,pi.getCorrelationId(),true,"String_Node_Str"));
  }
  final PlanInstanceListDTO list=new PlanInstanceListDTO();
  list.add(planInstances);
  list.add(UriUtil.generateSelfLink(uriInfo));
  return Response.ok(list).build();
}

Fixed version (ground truth):
/** 
 */
public Response getPlanInstances(final String plan,final UriInfo uriInfo,final CSARID csarId,final QName serviceTemplate,final Long serviceTemplateInstanceId,final PlanTypes... planTypes){
  if (!hasPlan(csarId,planTypes,plan)) {
    logger.info("String_Node_Str" + plan + "String_Node_Str");
    throw new NotFoundException("String_Node_Str" + plan + "String_Node_Str");
  }
  ServiceTemplateInstanceRepository repo=new ServiceTemplateInstanceRepository();
  final Collection<ServiceTemplateInstance> serviceInstances;
  if (serviceTemplateInstanceId != null) {
    serviceInstances=Lists.newArrayList();
    serviceInstances.add(repo.find(serviceTemplateInstanceId).get());
  }
 else {
    serviceInstances=repo.findByCsarId(csarId);
  }
  final List<PlanInstanceDTO> planInstances=Lists.newArrayList();
  for (  ServiceTemplateInstance sti : serviceInstances) {
    List<PlanInstanceDTO> foo=sti.getPlanInstances().stream().filter(p -> {
      PlanTypes currType=PlanTypes.isPlanTypeURI(p.getType().toString());
      return Arrays.asList(planTypes).contains(currType);
    }
).map(p -> PlanInstanceDTO.Converter.convert(p)).collect(Collectors.toList());
    planInstances.addAll(foo);
  }
  for (  final PlanInstanceDTO pi : planInstances) {
    final Long id=pi.getServiceTemplateInstanceId();
    if (id != null) {
      final URI uri=uriInfo.getBaseUriBuilder().path("String_Node_Str").build(csarId.toString(),serviceTemplate.toString(),String.valueOf(id));
      pi.add(Link.fromUri(UriUtil.encode(uri)).rel("String_Node_Str").build());
    }
    pi.add(UriUtil.generateSubResourceLink(uriInfo,pi.getCorrelationId(),true,"String_Node_Str"));
  }
  final PlanInstanceListDTO list=new PlanInstanceListDTO();
  list.add(planInstances);
  list.add(UriUtil.generateSelfLink(uriInfo));
  return Response.ok(list).build();
}