Program: 25466
Project: 25466
Buggy source:
public List<OFMessage> managedPacketOut(OFPacketOut outPacket){
  List<OFAction> newActions=new ArrayList<OFAction>();
  List<OFAction> actions=outPacket.getActions();
  List<OFMessage> packets=new ArrayList<OFMessage>();
  Iterator<OFAction> it=actions.iterator();
  OFMatch match=new OFMatch();
  if (outPacket.getPacketData().length == 0 && outPacket.getBufferId() != 0) {
    int bufferId=outPacket.getBufferId();
    if (this.bufferIds.containsKey(bufferId)) {
      outPacket.setBufferId(OFPacketOut.BUFFER_ID_NONE);
      outPacket.setPacketData(this.bufferIds.get(bufferId));
      outPacket.setLengthU(outPacket.getLengthU() + this.bufferIds.get(bufferId).length);
    }
 else {
      return packets;
    }
  }
  try {
    match.loadFromPacket(outPacket.getPacketData(),(short)0);
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + e.getMessage());
    packets.clear();
    return packets;
  }
  log.error("String_Node_Str" + match.getDataLayerVirtualLan());
  if (match.getDataLayerVirtualLan() != -1) {
    log.error("String_Node_Str");
    packets.clear();
    return packets;
  }
  while (it.hasNext()) {
    OFAction action=it.next();
switch (action.getType()) {
case SET_VLAN_ID:
      packets.clear();
    return packets;
case OUTPUT:
  OFActionOutput output=(OFActionOutput)action;
if (output.getPort() == OFPort.OFPP_ALL.getValue()) {
  log.info("String_Node_Str");
  for (  Map.Entry<String,PortConfig> port : this.portList.entrySet()) {
    PortConfig myPortCfg=this.getPortConfig(port.getValue().getPortId());
    if (myPortCfg == null) {
      log.info("String_Node_Str" + port.getValue().getPortId());
      packets.clear();
      return packets;
    }
    List<OFAction> actualActions=new ArrayList<OFAction>();
    actualActions.addAll(newActions);
    OFPacketOut newOut=this.clonePacketOut(outPacket);
    OFActionOutput newOutput=new OFActionOutput();
    newOutput.setMaxLength(Short.MAX_VALUE);
    newOutput.setType(OFActionType.OUTPUT);
    newOutput.setLength((short)OFActionOutput.MINIMUM_LENGTH);
    newOutput.setPort(port.getValue().getPortId());
    OFActionVirtualLanIdentifier set_vlan_vid=new OFActionVirtualLanIdentifier();
    set_vlan_vid.setVirtualLanIdentifier(myPortCfg.getVlanRange().getAvailableTags()[0]);
    actualActions.add(set_vlan_vid);
    actualActions.add(newOutput);
    newOut.setActions(actualActions);
    int size=0;
    for (    OFAction act : actualActions) {
      size=size + act.getLengthU();
    }
    newOut.setActionsLength((short)size);
    packets.add(newOut);
  }
}
 else if (output.getPort() == OFPort.OFPP_FLOOD.getValue()) {
  log.info("String_Node_Str");
  packets.clear();
  return packets;
}
 else {
  PortConfig myPortCfg=this.getPortConfig(output.getPort());
  if (myPortCfg == null) {
    log.info("String_Node_Str" + output.getPort());
    packets.clear();
    return packets;
  }
  log.error("String_Node_Str");
  List<OFAction> actualActions=new ArrayList<OFAction>();
  actualActions.addAll(newActions);
  OFPacketOut newOut=this.clonePacketOut(outPacket);
  OFActionVirtualLanIdentifier set_vlan_vid=new OFActionVirtualLanIdentifier();
  set_vlan_vid.setVirtualLanIdentifier(myPortCfg.getVlanRange().getAvailableTags()[0]);
  actualActions.add(set_vlan_vid);
  actualActions.add(output);
  newOut.setActions(actualActions);
  int size=0;
  for (  OFAction act : actualActions) {
    size=size + act.getLengthU();
  }
  newOut.setActionsLength((short)size);
  packets.add(newOut);
}
break;
case STRIP_VLAN:
packets.clear();
return packets;
default :
newActions.add(action);
break;
}
}
log.debug("String_Node_Str" + packets.toString());
return packets;
}

Fixed version (ground truth):
public List<OFMessage> managedPacketOut(OFPacketOut outPacket){
  List<OFAction> newActions=new ArrayList<OFAction>();
  List<OFAction> actions=outPacket.getActions();
  List<OFMessage> packets=new ArrayList<OFMessage>();
  Iterator<OFAction> it=actions.iterator();
  OFMatch match=new OFMatch();
  if (outPacket.getPacketData().length == 0 && outPacket.getBufferId() != 0) {
    int bufferId=outPacket.getBufferId();
    if (this.bufferIds.containsKey(bufferId)) {
      outPacket.setBufferId(OFPacketOut.BUFFER_ID_NONE);
      outPacket.setPacketData(this.bufferIds.get(bufferId));
      outPacket.setLengthU(outPacket.getLengthU() + this.bufferIds.get(bufferId).length);
    }
 else {
      return packets;
    }
  }
  try {
    match.loadFromPacket(outPacket.getPacketData(),(short)0);
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + e.getMessage());
    packets.clear();
    return packets;
  }
  log.error("String_Node_Str" + match.getDataLayerVirtualLan());
  if (match.getDataLayerVirtualLan() != -1) {
    log.error("String_Node_Str");
    packets.clear();
    return packets;
  }
  while (it.hasNext()) {
    OFAction action=it.next();
switch (action.getType()) {
case SET_VLAN_ID:
      packets.clear();
    return packets;
case OUTPUT:
  OFActionOutput output=(OFActionOutput)action;
if (output.getPort() == OFPort.OFPP_ALL.getValue()) {
  log.info("String_Node_Str");
  for (  Map.Entry<String,PortConfig> port : this.portList.entrySet()) {
    PortConfig myPortCfg=this.getPortConfig(port.getValue().getPortId());
    if (myPortCfg == null) {
      log.info("String_Node_Str" + port.getValue().getPortId());
      packets.clear();
      return packets;
    }
    List<OFAction> actualActions=new ArrayList<OFAction>();
    actualActions.addAll(newActions);
    OFPacketOut newOut=this.clonePacketOut(outPacket);
    OFActionOutput newOutput=new OFActionOutput();
    newOutput.setMaxLength(Short.MAX_VALUE);
    newOutput.setType(OFActionType.OUTPUT);
    newOutput.setLength((short)OFActionOutput.MINIMUM_LENGTH);
    newOutput.setPort(port.getValue().getPortId());
    OFActionVirtualLanIdentifier set_vlan_vid=new OFActionVirtualLanIdentifier();
    set_vlan_vid.setVirtualLanIdentifier(myPortCfg.getVlanRange().getAvailableTags()[0]);
    actualActions.add(set_vlan_vid);
    actualActions.add(newOutput);
    newOut.setActions(actualActions);
    int size=0;
    for (    OFAction act : actualActions) {
      size=size + act.getLengthU();
    }
    newOut.setActionsLength((short)size);
    newOut.setLength((short)(OFPacketOut.MINIMUM_LENGTH + newOut.getPacketData().length + size));
    packets.add(newOut);
  }
}
 else if (output.getPort() == OFPort.OFPP_FLOOD.getValue()) {
  log.info("String_Node_Str");
  packets.clear();
  return packets;
}
 else {
  PortConfig myPortCfg=this.getPortConfig(output.getPort());
  if (myPortCfg == null) {
    log.info("String_Node_Str" + output.getPort());
    packets.clear();
    return packets;
  }
  log.error("String_Node_Str");
  List<OFAction> actualActions=new ArrayList<OFAction>();
  actualActions.addAll(newActions);
  OFPacketOut newOut=this.clonePacketOut(outPacket);
  OFActionVirtualLanIdentifier set_vlan_vid=new OFActionVirtualLanIdentifier();
  set_vlan_vid.setVirtualLanIdentifier(myPortCfg.getVlanRange().getAvailableTags()[0]);
  actualActions.add(set_vlan_vid);
  actualActions.add(output);
  newOut.setActions(actualActions);
  int size=0;
  for (  OFAction act : actualActions) {
    size=size + act.getLengthU();
  }
  newOut.setActionsLength((short)size);
  newOut.setLength((short)(OFPacketOut.MINIMUM_LENGTH + newOut.getPacketData().length + size));
  packets.add(newOut);
}
break;
case STRIP_VLAN:
packets.clear();
return packets;
default :
newActions.add(action);
break;
}
}
log.debug("String_Node_Str" + packets.toString());
return packets;
}