Program: 132138
Project: 132138
Buggy source:
public void processRenderedServicePath(RenderedServicePath rsp,boolean addFlow){
  this.addFlow=addFlow;
  sfcL2ProviderUtils.addRsp(rsp.getPathId());
  String prevSffName=SffGraph.INGRESS;
  SffGraph sffGraph=new SffGraph();
  try {
    Iterator<RenderedServicePathHop> servicePathHopIter=rsp.getRenderedServicePathHop().iterator();
    String sfName=null;
    String sfgName=null;
    while (servicePathHopIter.hasNext()) {
      RenderedServicePathHop rspHop=servicePathHopIter.next();
      String curSffName=rspHop.getServiceFunctionForwarder();
      sfName=rspHop.getServiceFunctionName();
      sfgName=rspHop.getServiceFunctionGroupName();
      LOG.info("String_Node_Str",rsp.getPathId(),rspHop.getHopNumber());
      sffGraph.addGraphEntry(prevSffName,curSffName,sfName,sfgName,rsp.getPathId(),rspHop.getServiceIndex());
      prevSffName=curSffName;
    }
    sffGraph.addGraphEntry(prevSffName,SffGraph.EGRESS,sfName,sfgName,rsp.getPathId(),(short)0);
    processSffDpls(sffGraph,rsp.getTransportType().getName());
    setRspTransports(sffGraph,rsp.getTransportType(),rsp.getPathId());
    Iterator<SffGraph.SffGraphEntry> sffGraphIter=sffGraph.getGraphEntryIterator();
    while (sffGraphIter.hasNext()) {
      SffGraph.SffGraphEntry entry=sffGraphIter.next();
      LOG.debug("String_Node_Str",entry);
      if (!entry.getDstSff().equals(SffGraph.EGRESS)) {
        initializeSff(entry.getDstSff(),entry.getPathId());
      }
      configureSffIngress(entry,sffGraph);
      if (entry.getSf() != null) {
        configureSffEgress(entry,sffGraph);
      }
 else       if (entry.getSfg() != null) {
        configureSffEgressForGroup(entry,sffGraph);
      }
    }
  }
 catch (  RuntimeException e) {
    LOG.error("String_Node_Str",e.getMessage(),e);
  }
  sfcL2ProviderUtils.removeRsp(rsp.getPathId());
}

Fixed version (ground truth):
public void processRenderedServicePath(RenderedServicePath rsp,boolean addFlow){
  this.addFlow=addFlow;
  sfcL2ProviderUtils.addRsp(rsp.getPathId());
  String prevSffName=SffGraph.INGRESS;
  SffGraph sffGraph=new SffGraph();
  try {
    Iterator<RenderedServicePathHop> servicePathHopIter=rsp.getRenderedServicePathHop().iterator();
    String sfName=null;
    String sfgName=null;
    short lastServiceIndex=rsp.getStartingIndex();
    while (servicePathHopIter.hasNext()) {
      RenderedServicePathHop rspHop=servicePathHopIter.next();
      String curSffName=rspHop.getServiceFunctionForwarder();
      sfName=rspHop.getServiceFunctionName();
      sfgName=rspHop.getServiceFunctionGroupName();
      LOG.info("String_Node_Str",rsp.getPathId(),rspHop.getHopNumber());
      sffGraph.addGraphEntry(prevSffName,curSffName,sfName,sfgName,rsp.getPathId(),rspHop.getServiceIndex());
      lastServiceIndex=rspHop.getServiceIndex();
      prevSffName=curSffName;
    }
    sffGraph.addGraphEntry(prevSffName,SffGraph.EGRESS,sfName,sfgName,rsp.getPathId(),(short)(lastServiceIndex - 1));
    processSffDpls(sffGraph,rsp.getTransportType().getName());
    setRspTransports(sffGraph,rsp.getTransportType(),rsp.getPathId());
    Iterator<SffGraph.SffGraphEntry> sffGraphIter=sffGraph.getGraphEntryIterator();
    while (sffGraphIter.hasNext()) {
      SffGraph.SffGraphEntry entry=sffGraphIter.next();
      LOG.debug("String_Node_Str",entry);
      if (!entry.getDstSff().equals(SffGraph.EGRESS)) {
        initializeSff(entry.getDstSff(),entry.getPathId());
      }
      configureSffIngress(entry,sffGraph);
      if (entry.getSf() != null) {
        configureSffEgress(entry,sffGraph);
      }
 else       if (entry.getSfg() != null) {
        configureSffEgressForGroup(entry,sffGraph);
      }
    }
  }
 catch (  RuntimeException e) {
    LOG.error("String_Node_Str",e.getMessage(),e);
  }
  sfcL2ProviderUtils.removeRsp(rsp.getPathId());
}