Program: 25449
Project: 25449
Buggy source:
public List<OFFlowMod> managedFlows(OFFlowMod flowMod){
  log.debug("String_Node_Str" + flowMod.toString() + "String_Node_Str");
  List<OFFlowMod> flows=new ArrayList<OFFlowMod>();
  OFMatch match=flowMod.getMatch();
  if (match == null) {
    return flows;
  }
  if (match.getDataLayerVirtualLan() == 0 || match.getDataLayerVirtualLan() == -1) {
    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) {
          try {
            OFFlowMod newFlow=flowMod.clone();
            newFlow.getMatch().setInputPort(port.getValue().getPortId());
            newFlow.getMatch().setWildcards(newFlow.getMatch().getWildcardObj().matchOn(Flag.IN_PORT));
            newFlow.getMatch().setDataLayerVirtualLan(port.getValue().getVlanRange().getAvailableTags()[0]);
            newFlow.getMatch().setWildcards(newFlow.getMatch().getWildcardObj().matchOn(Flag.DL_VLAN));
            List<OFFlowMod> newFlows=this.managedFlowActions(newFlow);
            for (            OFFlowMod flow : newFlows) {
              flows.add(flow);
            }
          }
 catch (          CloneNotSupportedException e) {
            flows.clear();
            return flows;
          }
catch (          Exception e) {
            flows.clear();
            return flows;
          }
        }
      }
    }
 else {
      short vlanId;
      PortConfig pConfig=this.getPortConfig(match.getInputPort());
      if (pConfig == null) {
        flows.clear();
        return flows;
      }
 else {
        vlanId=(short)pConfig.getVlanRange().getAvailableTags()[0];
      }
      match.setDataLayerVirtualLan(vlanId);
      flowMod.setMatch(match);
      flows=this.managedFlowActions(flowMod);
    }
  }
 else {
    log.debug("String_Node_Str" + flowMod.toString());
    return flows;
  }
  return flows;
}

Fixed version (ground truth):
public List<OFFlowMod> managedFlows(OFFlowMod flowMod){
  log.debug("String_Node_Str" + flowMod.toString() + "String_Node_Str");
  List<OFFlowMod> flows=new ArrayList<OFFlowMod>();
  OFMatch match=flowMod.getMatch();
  if (match == null) {
    return flows;
  }
  if (match.getWildcardObj().isWildcarded(Flag.DL_VLAN) || match.getDataLayerVirtualLan() == -1) {
    if (match.getWildcardObj().isWildcarded(Flag.IN_PORT)) {
      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) {
          try {
            OFFlowMod newFlow=flowMod.clone();
            newFlow.getMatch().setInputPort(port.getValue().getPortId());
            newFlow.getMatch().setWildcards(newFlow.getMatch().getWildcardObj().matchOn(Flag.IN_PORT));
            newFlow.getMatch().setDataLayerVirtualLan(port.getValue().getVlanRange().getAvailableTags()[0]);
            newFlow.getMatch().setWildcards(newFlow.getMatch().getWildcardObj().matchOn(Flag.DL_VLAN));
            List<OFFlowMod> newFlows=this.managedFlowActions(newFlow);
            for (            OFFlowMod flow : newFlows) {
              flows.add(flow);
            }
          }
 catch (          CloneNotSupportedException e) {
            flows.clear();
            return flows;
          }
catch (          Exception e) {
            flows.clear();
            return flows;
          }
        }
      }
    }
 else {
      short vlanId;
      PortConfig pConfig=this.getPortConfig(match.getInputPort());
      if (pConfig == null) {
        flows.clear();
        return flows;
      }
 else {
        vlanId=(short)pConfig.getVlanRange().getAvailableTags()[0];
      }
      match.setDataLayerVirtualLan(vlanId);
      match.setWildcards(match.getWildcardObj().matchOn(Flag.DL_VLAN));
      flowMod.setMatch(match);
      flows=this.managedFlowActions(flowMod);
    }
  }
 else {
    log.debug("String_Node_Str" + flowMod.toString());
    return flows;
  }
  return flows;
}