Program: 132079
Project: 132079
Buggy source:
private boolean removeVxlanGpeClassifier(ServiceFunctionClassifier scf){
  Optional<Acl> theAcl=extractAcl(scf);
  if (!theAcl.isPresent() || !validateInputs(theAcl.get())) {
    LOG.error("String_Node_Str",scf);
    return false;
  }
  Map<RspName,List<Pair<HexString>>> rspPairList=new HashMap<RspName,List<Pair<HexString>>>();
  List<Ace> aceList=theAcl.get().getAccessListEntries().getAce();
  for (  Ace ace : aceList) {
    Optional<RspName> rspName=Optional.ofNullable(ace.getActions()).map(theActions -> theActions.getAugmentation(Actions1.class)).map(actions1 -> (AclRenderedServicePath)actions1.getSfcAction()).map(aclRsp -> new RspName(aclRsp.getRenderedServicePath()));
    if (!rspName.isPresent()) {
      LOG.error("String_Node_Str",scf);
    }
    List<Pair<HexString>> pairList=rspPairList.get(rspName.get());
    if (pairList == null) {
      pairList=new ArrayList<>();
      rspPairList.put(rspName.get(),pairList);
    }
    pairList.add(getMaskAndMatch(ace.getMatches()));
  }
  List<SclServiceFunctionForwarder> sfflist=scf.getSclServiceFunctionForwarder();
  if (sfflist == null) {
    LOG.error("String_Node_Str");
    return false;
  }
  for (  SclServiceFunctionForwarder sclSff : sfflist) {
    SffName sffName=new SffName(sclSff.getName());
    Optional<String> itfName=getInterfaceNameFromClassifier(sclSff);
    if (!itfName.isPresent()) {
      LOG.error("String_Node_Str");
    }
    IpAddress sffIp=SfcVppUtils.getSffFirstDplIp(sffName);
    DataBroker mountPoint=SfcVppUtils.getSffMountpoint(this.nodeManager.getMountPointService(),sffName);
    for (    RspName rsp : rspPairList.keySet()) {
      SffInfo sffInfo=getFirstSffInfoInRsp(rsp);
      RspName reverseRspName=getReverseRspName(rsp);
      RenderedServicePath reverseRenderedServicePath=getRenderedServicePath(reverseRspName);
      if (reverseRenderedServicePath == null) {
        LOG.error("String_Node_Str");
        return false;
      }
      Long reversePathId=reverseRenderedServicePath.getPathId();
      List<RenderedServicePathHop> hopList=reverseRenderedServicePath.getRenderedServicePathHop();
      if (hopList == null || hopList.isEmpty()) {
        LOG.error("String_Node_Str",reverseRenderedServicePath.getName().getValue());
        return false;
      }
      RenderedServicePathHop lastRspHop=Iterables.getLast(hopList);
      if (lastRspHop == null) {
        LOG.error("String_Node_Str");
        return false;
      }
      Short reverseServiceIndex=(short)(lastRspHop.getServiceIndex() - 1);
      List<Pair<HexString>> pairList=rspPairList.get(rsp);
      int length=pairList.size();
      int index=0;
      List<String> tableKeyList=new ArrayList<>();
      List<HexString> matchList=new ArrayList<>();
      for (      Pair<HexString> maskMatch : pairList) {
        String classifyTableKey=SfcVppUtils.getSavedClassifyTableKey(sffName.getValue(),rsp.getValue(),index);
        tableKeyList.add(classifyTableKey);
        matchList.add(maskMatch.getMatch());
        index++;
      }
      SfcVppUtils.disableIngressAcl(mountPoint,itfName.get(),SfcVppUtils.buildClassifyTableKey(0),sffName.getValue());
      SfcVppUtils.removeVppClassifier(mountPoint,sffName,tableKeyList,matchList);
      SfcVppUtils.removeClassifierVxlanGpeNsh(mountPoint,sffName,SFC_BD_NAME,sffIp,sffInfo.ip,sffInfo.pathId,sffInfo.serviceIndex);
      SfcVppUtils.removeNshEntry(mountPoint,reversePathId,reverseServiceIndex,sffName.getValue());
      SfcVppUtils.removeNshMap(mountPoint,reversePathId,reverseServiceIndex,reversePathId,reverseServiceIndex,sffName.getValue());
      SfcVppUtils.removeVxlanGpeNsh(sffInfo.mountPoint,sffInfo.sffName,sffInfo.ip,sffIp,reversePathId,reverseServiceIndex);
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean removeVxlanGpeClassifier(ServiceFunctionClassifier scf){
  Optional<Acl> theAcl=extractAcl(scf);
  if (!theAcl.isPresent() || !validateInputs(theAcl.get())) {
    LOG.error("String_Node_Str",scf);
    return false;
  }
  Map<RspName,List<Pair<HexString>>> rspPairList=new HashMap<RspName,List<Pair<HexString>>>();
  List<Ace> aceList=theAcl.get().getAccessListEntries().getAce();
  for (  Ace ace : aceList) {
    Optional<RspName> rspName=Optional.ofNullable(ace.getActions()).map(theActions -> theActions.getAugmentation(Actions1.class)).map(actions1 -> (AclRenderedServicePath)actions1.getSfcAction()).map(aclRsp -> new RspName(aclRsp.getRenderedServicePath()));
    if (!rspName.isPresent()) {
      LOG.error("String_Node_Str",scf);
    }
    List<Pair<HexString>> pairList=rspPairList.get(rspName.get());
    if (pairList == null) {
      pairList=new ArrayList<>();
      rspPairList.put(rspName.get(),pairList);
    }
    pairList.add(getMaskAndMatch(ace.getMatches()));
  }
  List<SclServiceFunctionForwarder> sfflist=scf.getSclServiceFunctionForwarder();
  if (sfflist == null) {
    LOG.error("String_Node_Str");
    return false;
  }
  for (  SclServiceFunctionForwarder sclSff : sfflist) {
    SffName sffName=new SffName(sclSff.getName());
    Optional<String> itfName=getInterfaceNameFromClassifier(sclSff);
    if (!itfName.isPresent()) {
      LOG.error("String_Node_Str");
    }
    IpAddress sffIp=SfcVppUtils.getSffFirstDplIp(sffName);
    DataBroker mountPoint=SfcVppUtils.getSffMountpoint(this.nodeManager.getMountPointService(),sffName);
    for (    RspName rsp : rspPairList.keySet()) {
      SffInfo sffInfo=getFirstSffInfoInRsp(rsp);
      RspName reverseRspName=getReverseRspName(rsp);
      RenderedServicePath reverseRenderedServicePath=getRenderedServicePath(reverseRspName);
      if (reverseRenderedServicePath == null) {
        LOG.error("String_Node_Str");
        return false;
      }
      Long reversePathId=reverseRenderedServicePath.getPathId();
      List<RenderedServicePathHop> hopList=reverseRenderedServicePath.getRenderedServicePathHop();
      if (hopList == null || hopList.isEmpty()) {
        LOG.error("String_Node_Str",reverseRenderedServicePath.getName().getValue());
        return false;
      }
      RenderedServicePathHop lastRspHop=Iterables.getLast(hopList);
      if (lastRspHop == null) {
        LOG.error("String_Node_Str");
        return false;
      }
      Short reverseServiceIndex=(short)(lastRspHop.getServiceIndex() - 1);
      List<Pair<HexString>> pairList=rspPairList.get(rsp);
      int length=pairList.size();
      int index=0;
      List<String> tableKeyList=new ArrayList<>();
      List<HexString> matchList=new ArrayList<>();
      for (      Pair<HexString> maskMatch : pairList) {
        String classifyTableKey=SfcVppUtils.getSavedClassifyTableKey(sffName.getValue(),rsp.getValue(),index);
        tableKeyList.add(classifyTableKey);
        matchList.add(maskMatch.getMatch());
        index++;
      }
      SfcVppUtils.disableIngressAcl(mountPoint,itfName.get(),SfcVppUtils.buildClassifyTableKey(0),sffName.getValue());
      SfcVppUtils.removeVppClassifier(mountPoint,sffName,tableKeyList,matchList);
      SfcVppUtils.removeNshMap(mountPoint,reversePathId,reverseServiceIndex,reversePathId,reverseServiceIndex,sffName.getValue());
      SfcVppUtils.removeNshEntry(mountPoint,reversePathId,reverseServiceIndex,sffName.getValue());
      SfcVppUtils.removeVxlanGpeNsh(sffInfo.mountPoint,sffInfo.sffName,sffInfo.ip,sffIp,reversePathId,reverseServiceIndex);
      SfcVppUtils.removeClassifierVxlanGpeNsh(mountPoint,sffName,SFC_BD_NAME,sffIp,sffInfo.ip,sffInfo.pathId,sffInfo.serviceIndex);
    }
  }
  return true;
}