Program: 25441
Project: 25441
Buggy source:
/** 
 * processFlow - processes a FlowStat and updates or removes the flow
 * @param switchId
 * @param flowStat
 * @param time
 * @param flowCount
 */
private void processFlow(Long switchId,OFFlowStatisticsReply flowStat,long time,HashMap<String,Integer> flowCount){
  if (!map.containsKey(switchId)) {
    HashMap<OFMatch,FSFWOFFlowStatisticsReply> tmpMap=new HashMap<OFMatch,FSFWOFFlowStatisticsReply>();
    map.put(switchId,tmpMap);
  }
  HashMap<OFMatch,FSFWOFFlowStatisticsReply> flowMap=map.get(switchId);
  if (flowMap.containsKey(flowStat.getMatch())) {
    log.debug("String_Node_Str");
    FSFWOFFlowStatisticsReply cachedStat=(FSFWOFFlowStatisticsReply)flowMap.get(flowStat.getMatch());
    if (cachedStat.compareActions(flowStat.getActions())) {
      if (this.updateFlowStatData(cachedStat,flowStat,flowCount)) {
        return;
      }
 else {
        log.error("String_Node_Str");
        return;
      }
    }
 else {
      log.error("String_Node_Str");
      log.error(cachedStat.toString());
      log.error(flowStat.toString());
      FSFWOFFlowStatisticsReply parentStat=cachedStat.getParentStat();
      OFFlowMod flow=this.buildFlowMod(parentStat);
      Slicer slice=this.parent.getProxy(switchId,parentStat.getSliceName()).getSlicer();
      List<OFFlowMod> flows;
      if (slice.getTagManagement()) {
        log.error("String_Node_Str");
        flows=slice.managedFlows(flow);
      }
 else {
        log.error("String_Node_Str");
        flows=slice.allowedFlows(flow);
      }
      this.delFlowMod(switchId,slice.getSliceName(),flow,flows);
    }
  }
 else {
    OFFlowMod flow=this.buildFlowMod(flowStat);
    Slicer slice=this.findSliceForFlow(switchId,flow);
    if (slice == null) {
      log.info("String_Node_Str" + flowStat.toString());
      this.deleteFlow(switchId,flowStat);
    }
 else {
      List<OFFlowMod> flows=new ArrayList<OFFlowMod>();
      if (slice.getTagManagement()) {
        flows.add(flow);
        OFFlowMod newFlow;
        try {
          newFlow=flow.clone();
          newFlow.getMatch().setDataLayerVirtualLan((short)0);
          newFlow.getMatch().setWildcards(newFlow.getMatch().getWildcardObj().wildcard(Wildcards.Flag.DL_VLAN));
          List<OFAction> newActions=new ArrayList<OFAction>();
          int length=0;
          for (          OFAction act : newFlow.getActions()) {
            if (act.getType() == OFActionType.SET_VLAN_ID) {
              continue;
            }
 else             if (act.getType() == OFActionType.STRIP_VLAN) {
              continue;
            }
 else {
              newActions.add(act);
              length+=act.getLength();
            }
          }
          newFlow.setActions(newActions);
          newFlow.setLength((short)(OFFlowMod.MINIMUM_LENGTH + length));
          this.addFlowMod(switchId,slice.getSliceName(),newFlow,flows);
        }
 catch (        CloneNotSupportedException e) {
          log.warn("String_Node_Str");
          return;
        }
      }
 else {
        flows.add(flow);
        this.addFlowMod(switchId,slice.getSliceName(),flow,flows);
      }
      FSFWOFFlowStatisticsReply cachedStat=(FSFWOFFlowStatisticsReply)flowMap.get(flowStat.getMatch());
      if (this.updateFlowStatData(cachedStat,flowStat,flowCount)) {
        return;
      }
 else {
        log.warn("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * processFlow - processes a FlowStat and updates or removes the flow
 * @param switchId
 * @param flowStat
 * @param time
 * @param flowCount
 */
private void processFlow(Long switchId,OFFlowStatisticsReply flowStat,long time,HashMap<String,Integer> flowCount){
  if (!map.containsKey(switchId)) {
    HashMap<OFMatch,FSFWOFFlowStatisticsReply> tmpMap=new HashMap<OFMatch,FSFWOFFlowStatisticsReply>();
    map.put(switchId,tmpMap);
  }
  HashMap<OFMatch,FSFWOFFlowStatisticsReply> flowMap=map.get(switchId);
  if (flowMap.containsKey(flowStat.getMatch())) {
    log.debug("String_Node_Str");
    FSFWOFFlowStatisticsReply cachedStat=(FSFWOFFlowStatisticsReply)flowMap.get(flowStat.getMatch());
    if (cachedStat.compareActions(flowStat.getActions())) {
      if (this.updateFlowStatData(cachedStat,flowStat,flowCount)) {
        return;
      }
 else {
        log.error("String_Node_Str");
        return;
      }
    }
 else {
      log.error("String_Node_Str");
      log.error(cachedStat.toString());
      log.error(flowStat.toString());
      FSFWOFFlowStatisticsReply parentStat=cachedStat.getParentStat();
      OFFlowMod flow=this.buildFlowMod(parentStat);
      Slicer slice=this.parent.getProxy(switchId,parentStat.getSliceName()).getSlicer();
      if (slice == null) {
        this.deleteFlow(switchId,parentStat);
        return;
      }
      List<OFFlowMod> flows;
      if (slice.getTagManagement()) {
        log.error("String_Node_Str");
        flows=slice.managedFlows(flow);
      }
 else {
        log.error("String_Node_Str");
        flows=slice.allowedFlows(flow);
      }
      this.delFlowMod(switchId,slice.getSliceName(),flow,flows);
    }
  }
 else {
    OFFlowMod flow=this.buildFlowMod(flowStat);
    Slicer slice=this.findSliceForFlow(switchId,flow);
    if (slice == null) {
      log.info("String_Node_Str" + flowStat.toString());
      this.deleteFlow(switchId,flowStat);
    }
 else {
      List<OFFlowMod> flows=new ArrayList<OFFlowMod>();
      if (slice.getTagManagement()) {
        flows.add(flow);
        OFFlowMod newFlow;
        try {
          newFlow=flow.clone();
          newFlow.getMatch().setDataLayerVirtualLan((short)0);
          newFlow.getMatch().setWildcards(newFlow.getMatch().getWildcardObj().wildcard(Wildcards.Flag.DL_VLAN));
          List<OFAction> newActions=new ArrayList<OFAction>();
          int length=0;
          for (          OFAction act : newFlow.getActions()) {
            if (act.getType() == OFActionType.SET_VLAN_ID) {
              continue;
            }
 else             if (act.getType() == OFActionType.STRIP_VLAN) {
              continue;
            }
 else {
              newActions.add(act);
              length+=act.getLength();
            }
          }
          newFlow.setActions(newActions);
          newFlow.setLength((short)(OFFlowMod.MINIMUM_LENGTH + length));
          this.addFlowMod(switchId,slice.getSliceName(),newFlow,flows);
        }
 catch (        CloneNotSupportedException e) {
          log.warn("String_Node_Str");
          return;
        }
      }
 else {
        flows.add(flow);
        this.addFlowMod(switchId,slice.getSliceName(),flow,flows);
      }
      FSFWOFFlowStatisticsReply cachedStat=(FSFWOFFlowStatisticsReply)flowMap.get(flowStat.getMatch());
      if (this.updateFlowStatData(cachedStat,flowStat,flowCount)) {
        return;
      }
 else {
        log.warn("String_Node_Str");
      }
    }
  }
}