Program: 25497
Project: 25497
Buggy source:
/** 
 * Takes a flowMod and determines if it can be sent to the switch based on the policy.  If it can then
 * @param flowMod OFFlowMod to be sliced and possibly explodedinto multiple flow mods
 */
public List<OFFlowMod> allowedFlows(OFFlowMod flowMod){
  log.debug("String_Node_Str" + flowMod.toString());
  List<OFFlowMod> flowMods=new ArrayList<OFFlowMod>();
  OFMatch match=flowMod.getMatch();
  if (match == null) {
    return flowMods;
  }
  if (match.getDataLayerVirtualLan() == 0) {
    log.error("String_Node_Str");
    return flowMods;
  }
  if (match.getInputPort() == 0) {
    Iterator<Entry<String,PortConfig>> it=this.portList.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<String,PortConfig> port=(Entry<String,PortConfig>)it.next();
      if (port.getValue().getPortId() != 0) {
        log.debug("String_Node_Str" + port.getValue().getPortId());
        try {
          OFFlowMod newFlow=flowMod.clone();
          newFlow.getMatch().setInputPort(port.getValue().getPortId());
          newFlow.getMatch().setWildcards(newFlow.getMatch().getWildcardObj().matchOn(Flag.IN_PORT));
          log.debug("String_Node_Str" + newFlow.getMatch().getInputPort());
          log.debug("String_Node_Str");
          OFFlowMod expandedFlow=this.expandActions(newFlow);
          if (this.isFlowAllowed(expandedFlow)) {
            flowMods.add(expandedFlow);
          }
 else {
            log.debug("String_Node_Str" + expandedFlow.toString());
            flowMods.clear();
            return flowMods;
          }
        }
 catch (        CloneNotSupportedException e) {
          log.error("String_Node_Str");
        }
catch (        Exception e) {
          log.error("String_Node_Str");
        }
      }
    }
    log.debug("String_Node_Str" + flowMods.size() + "String_Node_Str"+ sw.getPorts().size());
    if (flowMods.size() == sw.getPorts().size()) {
      log.debug("String_Node_Str");
      flowMods.clear();
      flowMods.add(flowMod);
    }
  }
 else {
    log.debug("String_Node_Str");
    log.debug("String_Node_Str");
    OFFlowMod expandedFlow=this.expandActions(flowMod);
    if (this.isFlowAllowed(expandedFlow)) {
      flowMods.add(expandedFlow);
    }
 else {
      log.debug("String_Node_Str" + expandedFlow.toString());
      flowMods.clear();
      return flowMods;
    }
  }
  log.debug("String_Node_Str" + flowMods.toString());
  return flowMods;
}

Fixed version (ground truth):
/** 
 * Takes a flowMod and determines if it can be sent to the switch based on the policy.  If it can then
 * @param flowMod OFFlowMod to be sliced and possibly explodedinto multiple flow mods
 */
public List<OFFlowMod> allowedFlows(OFFlowMod flowMod){
  log.debug("String_Node_Str" + flowMod.toString());
  List<OFFlowMod> flowMods=new ArrayList<OFFlowMod>();
  OFMatch match=flowMod.getMatch();
  if (match == null) {
    return flowMods;
  }
  if (match.getDataLayerVirtualLan() == 0) {
    log.error("String_Node_Str");
    return flowMods;
  }
  if (match.getInputPort() == 0) {
    Iterator<Entry<String,PortConfig>> it=this.portList.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<String,PortConfig> port=(Entry<String,PortConfig>)it.next();
      if (port.getValue().getPortId() != 0) {
        log.debug("String_Node_Str" + port.getValue().getPortId());
        try {
          OFFlowMod newFlow=flowMod.clone();
          newFlow.getMatch().setInputPort(port.getValue().getPortId());
          newFlow.getMatch().setWildcards(newFlow.getMatch().getWildcardObj().matchOn(Flag.IN_PORT));
          log.debug("String_Node_Str" + newFlow.getMatch().getInputPort());
          log.debug("String_Node_Str");
          OFFlowMod expandedFlow=this.expandActions(newFlow);
          if (expandedFlow == null) {
            log.warn("String_Node_Str" + newFlow.toString());
            flowMods.clear();
            return flowMods;
          }
          if (this.isFlowAllowed(expandedFlow)) {
            flowMods.add(expandedFlow);
          }
 else {
            log.debug("String_Node_Str" + expandedFlow.toString());
            flowMods.clear();
            return flowMods;
          }
        }
 catch (        CloneNotSupportedException e) {
          log.error("String_Node_Str");
        }
catch (        Exception e) {
          log.error("String_Node_Str");
        }
      }
    }
    log.debug("String_Node_Str" + flowMods.size() + "String_Node_Str"+ sw.getPorts().size());
    if (flowMods.size() == sw.getPorts().size()) {
      log.debug("String_Node_Str");
      flowMods.clear();
      flowMods.add(flowMod);
    }
  }
 else {
    log.debug("String_Node_Str");
    log.debug("String_Node_Str");
    OFFlowMod expandedFlow=this.expandActions(flowMod);
    if (expandedFlow == null) {
      log.warn("String_Node_Str" + flowMod.toString());
      flowMods.clear();
      return flowMods;
    }
    if (this.isFlowAllowed(expandedFlow)) {
      flowMods.add(expandedFlow);
    }
 else {
      log.debug("String_Node_Str" + expandedFlow.toString());
      flowMods.clear();
      return flowMods;
    }
  }
  log.debug("String_Node_Str" + flowMods.toString());
  return flowMods;
}