Program: 25457
Project: 25457
Buggy source:
private void processFlowMod(OFMessage msg,FloodlightContext cntx){
  List<OFFlowMod> flows;
  if (this.mySlicer.getTagManagement()) {
    flows=this.mySlicer.managedFlows((OFFlowMod)msg);
    if (flows.size() == 0) {
      log.error("String_Node_Str" + this.mySlicer.getSliceName() + "String_Node_Str"+ this.mySwitch.getStringId()+ "String_Node_Str"+ ((OFFlowMod)msg).toString());
      OFError error=new OFError(OFError.OFErrorType.OFPET_BAD_REQUEST);
      error.setErrorCode(OFBadRequestCode.OFPBRC_EPERM);
      this.sendError((OFMessage)msg,error);
      return;
    }
 else {
      log.info("String_Node_Str" + this.mySlicer.getSliceName() + "String_Node_Str"+ this.mySwitch.getStringId()+ "String_Node_Str"+ ((OFFlowMod)msg).toString());
    }
  }
 else {
    flows=this.mySlicer.allowedFlows((OFFlowMod)msg);
    if (flows.size() == 0) {
      log.error("String_Node_Str" + this.mySlicer.getSliceName() + "String_Node_Str"+ this.mySwitch.getStringId()+ "String_Node_Str"+ ((OFFlowMod)msg).toString());
      OFError error=new OFError(OFError.OFErrorType.OFPET_BAD_REQUEST);
      error.setErrorCode(OFBadRequestCode.OFPBRC_EPERM);
      this.sendError((OFMessage)msg,error);
      return;
    }
 else {
      log.info("String_Node_Str" + this.mySlicer.getSliceName() + "String_Node_Str"+ this.mySwitch.getStringId()+ "String_Node_Str"+ ((OFFlowMod)msg).toString());
    }
  }
  List<OFMessage> messages=new ArrayList<OFMessage>();
  Iterator<OFFlowMod> it=flows.iterator();
  while (it.hasNext()) {
    OFFlowMod flow=it.next();
switch (flow.getCommand()) {
case OFFlowMod.OFPFC_ADD:
      if (this.mySlicer.isGreaterThanMaxFlows(this.flowCount + 1)) {
        log.warn("String_Node_Str" + this.mySwitch.getStringId() + "String_Node_Str"+ this.mySlicer.getSliceName()+ "String_Node_Str");
        OFError error=new OFError(OFError.OFErrorType.OFPET_FLOW_MOD_FAILED);
        error.setErrorCode(OFError.OFFlowModFailedCode.OFPFMFC_ALL_TABLES_FULL);
        this.sendError((OFMessage)msg,error);
        return;
      }
    if (this.mySlicer.doTimeouts()) {
      if (flow.getIdleTimeout() != 0) {
        FlowTimeout timeout=new FlowTimeout(flow,flow.getIdleTimeout(),false);
        this.timeouts.add(timeout);
        flow.setIdleTimeout((short)0);
      }
      if (flow.getHardTimeout() != 0) {
        FlowTimeout timeout=new FlowTimeout(flow,flow.getHardTimeout(),true);
        this.timeouts.add(timeout);
        flow.setHardTimeout((short)0);
      }
    }
  this.updateFlowCount(1);
break;
case OFFlowMod.OFPFF_CHECK_OVERLAP:
if (this.mySlicer.isGreaterThanMaxFlows(this.flowCount + 1)) {
log.warn("String_Node_Str" + this.mySwitch.getStringId() + "String_Node_Str"+ this.mySlicer.getSliceName()+ "String_Node_Str");
OFError error=new OFError(OFError.OFErrorType.OFPET_FLOW_MOD_FAILED);
error.setErrorCode(OFError.OFFlowModFailedCode.OFPFMFC_ALL_TABLES_FULL);
this.sendError((OFMessage)msg,error);
return;
}
if (this.mySlicer.doTimeouts()) {
if (flow.getIdleTimeout() != 0) {
FlowTimeout timeout=new FlowTimeout(flow,flow.getIdleTimeout(),false);
this.timeouts.add(timeout);
flow.setIdleTimeout((short)0);
}
if (flow.getHardTimeout() != 0) {
FlowTimeout timeout=new FlowTimeout(flow,flow.getHardTimeout(),true);
this.timeouts.add(timeout);
flow.setHardTimeout((short)0);
}
}
this.updateFlowCount(1);
break;
case OFFlowMod.OFPFC_DELETE:
this.updateFlowCount(-1);
break;
case OFFlowMod.OFPFC_DELETE_STRICT:
this.updateFlowCount(-1);
break;
case OFFlowMod.OFPFC_MODIFY:
break;
}
messages.add((OFMessage)flow);
}
log.error("String_Node_Str" + messages.toString());
mapXids(messages);
try {
mySwitch.write(messages,cntx);
}
 catch (IOException e) {
e.printStackTrace();
}
mySwitch.flush();
}

Fixed version (ground truth):
private void processFlowMod(OFMessage msg,FloodlightContext cntx){
  List<OFFlowMod> flows;
  if (this.mySlicer.getTagManagement()) {
    flows=this.mySlicer.managedFlows((OFFlowMod)msg);
    if (flows.size() == 0) {
      log.error("String_Node_Str" + this.mySlicer.getSliceName() + "String_Node_Str"+ this.mySwitch.getStringId()+ "String_Node_Str"+ ((OFFlowMod)msg).toString());
      OFError error=new OFError(OFError.OFErrorType.OFPET_BAD_REQUEST);
      error.setErrorCode(OFBadRequestCode.OFPBRC_EPERM);
      this.sendError((OFMessage)msg,error);
      return;
    }
 else {
      log.info("String_Node_Str" + this.mySlicer.getSliceName() + "String_Node_Str"+ this.mySwitch.getStringId()+ "String_Node_Str"+ ((OFFlowMod)msg).toString());
    }
  }
 else {
    flows=this.mySlicer.allowedFlows((OFFlowMod)msg);
    if (flows.size() == 0) {
      log.error("String_Node_Str" + this.mySlicer.getSliceName() + "String_Node_Str"+ this.mySwitch.getStringId()+ "String_Node_Str"+ ((OFFlowMod)msg).toString());
      OFError error=new OFError(OFError.OFErrorType.OFPET_BAD_REQUEST);
      error.setErrorCode(OFBadRequestCode.OFPBRC_EPERM);
      this.sendError((OFMessage)msg,error);
      return;
    }
 else {
      log.info("String_Node_Str" + this.mySlicer.getSliceName() + "String_Node_Str"+ this.mySwitch.getStringId()+ "String_Node_Str"+ ((OFFlowMod)msg).toString());
    }
  }
  List<OFMessage> messages=new ArrayList<OFMessage>();
  Iterator<OFFlowMod> it=flows.iterator();
  while (it.hasNext()) {
    OFFlowMod flow=it.next();
switch (flow.getCommand()) {
case OFFlowMod.OFPFC_ADD:
      if (this.mySlicer.isGreaterThanMaxFlows(this.flowCount + 1)) {
        log.warn("String_Node_Str" + this.mySwitch.getStringId() + "String_Node_Str"+ this.mySlicer.getSliceName()+ "String_Node_Str");
        OFError error=new OFError(OFError.OFErrorType.OFPET_FLOW_MOD_FAILED);
        error.setErrorCode(OFError.OFFlowModFailedCode.OFPFMFC_ALL_TABLES_FULL);
        this.sendError((OFMessage)msg,error);
        return;
      }
    if (this.mySlicer.doTimeouts()) {
      if (flow.getIdleTimeout() != 0) {
        FlowTimeout timeout=new FlowTimeout(flow,flow.getIdleTimeout(),false,cntx);
        this.timeouts.add(timeout);
        flow.setIdleTimeout((short)0);
      }
      if (flow.getHardTimeout() != 0) {
        FlowTimeout timeout=new FlowTimeout(flow,flow.getHardTimeout(),true,cntx);
        this.timeouts.add(timeout);
        flow.setHardTimeout((short)0);
      }
    }
  this.updateFlowCount(1);
break;
case OFFlowMod.OFPFF_CHECK_OVERLAP:
if (this.mySlicer.isGreaterThanMaxFlows(this.flowCount + 1)) {
log.warn("String_Node_Str" + this.mySwitch.getStringId() + "String_Node_Str"+ this.mySlicer.getSliceName()+ "String_Node_Str");
OFError error=new OFError(OFError.OFErrorType.OFPET_FLOW_MOD_FAILED);
error.setErrorCode(OFError.OFFlowModFailedCode.OFPFMFC_ALL_TABLES_FULL);
this.sendError((OFMessage)msg,error);
return;
}
if (this.mySlicer.doTimeouts()) {
if (flow.getIdleTimeout() != 0) {
FlowTimeout timeout=new FlowTimeout(flow,flow.getIdleTimeout(),false,cntx);
this.timeouts.add(timeout);
flow.setIdleTimeout((short)0);
}
if (flow.getHardTimeout() != 0) {
FlowTimeout timeout=new FlowTimeout(flow,flow.getHardTimeout(),true,cntx);
this.timeouts.add(timeout);
flow.setHardTimeout((short)0);
}
}
this.updateFlowCount(1);
break;
case OFFlowMod.OFPFC_DELETE:
this.updateFlowCount(-1);
break;
case OFFlowMod.OFPFC_DELETE_STRICT:
this.updateFlowCount(-1);
break;
case OFFlowMod.OFPFC_MODIFY:
break;
}
messages.add((OFMessage)flow);
}
log.error("String_Node_Str" + messages.toString());
mapXids(messages);
try {
mySwitch.write(messages,cntx);
}
 catch (IOException e) {
e.printStackTrace();
}
mySwitch.flush();
}