Program: 50762
Project: 50762
Buggy source:
/** 
 * This method builds a service graph from a collection of service definitions.
 * @param sds The service definitions
 * @param sits The situations
 * @return The service graph
 */
public static ServiceGraph buildGraph(java.util.Set<ServiceDefinition> sds,java.util.List<Situation> sits){
  ServiceGraph ret=new ServiceGraph();
  java.util.Set<ServiceDefinition> initialNodes=getInitialServices(sds);
  for (  ServiceDefinition sd : sds) {
    ServiceNode sn=new ServiceNode();
    sn.setService(sd);
    for (    OperationDefinition op : sd.getOperations()) {
      OperationNode opn=new OperationNode();
      opn.setService(sd);
      opn.setOperation(op);
      String subject=sn.getService().getInterface() + "String_Node_Str" + op.getName();
      if (sits != null) {
        for (        Situation s : sits) {
          if (s.getSubject() != null && (s.getSubject().equals(subject) || s.getSubject().startsWith(subject + "String_Node_Str"))) {
            opn.getSituations().add(s);
          }
        }
      }
      sn.getOperations().add(opn);
    }
    sn.getProperties().put(ServiceNode.INITIAL_NODE,initialNodes.contains(sd));
    if (sits != null) {
      for (      Situation s : sits) {
        if (s.getSubject() != null && s.getSubject().equals(sn.getService().getInterface())) {
          sn.getSituations().add(s);
        }
      }
    }
    ret.getServiceNodes().add(sn);
  }
  for (  ServiceDefinition sd : sds) {
    for (    OperationDefinition op : sd.getOperations()) {
      ServiceNode sn=ret.getServiceNode(sd.getInterface());
      OperationNode opn=sn.getOperation(op.getName());
      for (      OperationImplDefinition stod : op.getImplementations()) {
        if (stod.getRequestResponse() != null) {
          linkOperationNodes(ret,sn,opn,stod.getRequestResponse().getInvocations());
        }
        for (        RequestFaultDefinition rfd : stod.getRequestFaults()) {
          linkOperationNodes(ret,sn,opn,rfd.getInvocations());
        }
      }
    }
  }
  return (ret);
}

Fixed version (ground truth):
/** 
 * This method builds a service graph from a collection of service definitions.
 * @param sds The service definitions
 * @param sits The situations
 * @return The service graph
 */
public static ServiceGraph buildGraph(java.util.Set<ServiceDefinition> sds,java.util.List<Situation> sits){
  ServiceGraph ret=new ServiceGraph();
  java.util.Set<ServiceDefinition> initialNodes=getInitialServices(sds);
  for (  ServiceDefinition sd : sds) {
    ServiceNode sn=new ServiceNode();
    sn.setService(sd);
    for (    OperationDefinition op : sd.getOperations()) {
      OperationNode opn=new OperationNode();
      opn.setService(sd);
      opn.setOperation(op);
      if (sits != null) {
        for (        Situation s : sits) {
          String[] parts=s.subjectAsParts();
          if (parts.length > 1 && parts[0].equals(sn.getService().getInterface()) && parts[1].equals(op.getName())) {
            opn.getSituations().add(s);
          }
        }
      }
      sn.getOperations().add(opn);
    }
    sn.getProperties().put(ServiceNode.INITIAL_NODE,initialNodes.contains(sd));
    if (sits != null) {
      for (      Situation s : sits) {
        String[] parts=s.subjectAsParts();
        if (parts.length == 1 && parts[0].equals(sn.getService().getInterface())) {
          sn.getSituations().add(s);
        }
      }
    }
    ret.getServiceNodes().add(sn);
  }
  for (  ServiceDefinition sd : sds) {
    for (    OperationDefinition op : sd.getOperations()) {
      ServiceNode sn=ret.getServiceNode(sd.getInterface());
      OperationNode opn=sn.getOperation(op.getName());
      for (      OperationImplDefinition stod : op.getImplementations()) {
        if (stod.getRequestResponse() != null) {
          linkOperationNodes(ret,sn,opn,stod.getRequestResponse().getInvocations());
        }
        for (        RequestFaultDefinition rfd : stod.getRequestFaults()) {
          linkOperationNodes(ret,sn,opn,rfd.getInvocations());
        }
      }
    }
  }
  return (ret);
}