Program: 105806
Project: 105806
Buggy source:
@Override public InterfaceDef plug(NicTO nic,String guestOsType,String nicAdapter) throws InternalErrorException, LibvirtException {
  s_logger.debug("String_Node_Str" + nic);
  LibvirtVMDef.InterfaceDef intf=new LibvirtVMDef.InterfaceDef();
  intf.setVirtualPortType("String_Node_Str");
  String vlanId=null;
  String logicalSwitchUuid=null;
  if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan) {
    vlanId=Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
  }
 else   if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) {
    logicalSwitchUuid=Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
  }
 else   if (nic.getBroadcastType() == Networks.BroadcastDomainType.Pvlan) {
    vlanId=NetUtils.getPrimaryPvlanFromUri(nic.getBroadcastUri());
  }
  String trafficLabel=nic.getName();
  if (nic.getType() == Networks.TrafficType.Guest) {
    Integer networkRateKBps=(nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
    if ((nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan || nic.getBroadcastType() == Networks.BroadcastDomainType.Pvlan) && !vlanId.equalsIgnoreCase("String_Node_Str")) {
      if (trafficLabel != null && !trafficLabel.isEmpty()) {
        s_logger.debug("String_Node_Str" + trafficLabel);
        intf.defBridgeNet(_pifs.get(trafficLabel),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
        intf.setVlanTag(Integer.parseInt(vlanId));
      }
 else {
        intf.defBridgeNet(_pifs.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
        intf.setVlanTag(Integer.parseInt(vlanId));
      }
    }
 else     if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch || nic.getBroadcastType() == Networks.BroadcastDomainType.OpenDaylight) {
      s_logger.debug("String_Node_Str" + nic + "String_Node_Str"+ logicalSwitchUuid);
      intf.setVirtualPortInterfaceId(nic.getUuid());
      String brName=(trafficLabel != null && !trafficLabel.isEmpty()) ? _pifs.get(trafficLabel) : _pifs.get("String_Node_Str");
      intf.defBridgeNet(brName,null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
    }
 else {
      intf.defBridgeNet(_bridges.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
    }
  }
 else   if (nic.getType() == Networks.TrafficType.Control) {
    createControlNetwork(_bridges.get("String_Node_Str"));
    intf.defBridgeNet(_bridges.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter));
  }
 else   if (nic.getType() == Networks.TrafficType.Public) {
    Integer networkRateKBps=(nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
    if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan && !vlanId.equalsIgnoreCase("String_Node_Str")) {
      if (trafficLabel != null && !trafficLabel.isEmpty()) {
        s_logger.debug("String_Node_Str" + trafficLabel);
        intf.defBridgeNet(_pifs.get(trafficLabel),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
        intf.setVlanTag(Integer.parseInt(vlanId));
      }
 else {
        intf.defBridgeNet(_pifs.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
        intf.setVlanTag(Integer.parseInt(vlanId));
      }
    }
 else {
      intf.defBridgeNet(_bridges.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
    }
  }
 else   if (nic.getType() == Networks.TrafficType.Management) {
    intf.defBridgeNet(_bridges.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter));
  }
 else   if (nic.getType() == Networks.TrafficType.Storage) {
    String storageBrName=nic.getName() == null ? _bridges.get("String_Node_Str") : nic.getName();
    intf.defBridgeNet(storageBrName,null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter));
  }
  return intf;
}

Fixed version (ground truth):
@Override public InterfaceDef plug(NicTO nic,String guestOsType,String nicAdapter) throws InternalErrorException, LibvirtException {
  s_logger.debug("String_Node_Str" + nic);
  LibvirtVMDef.InterfaceDef intf=new LibvirtVMDef.InterfaceDef();
  intf.setVirtualPortType("String_Node_Str");
  String vlanId=null;
  String logicalSwitchUuid=null;
  if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan) {
    vlanId=Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
  }
 else   if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) {
    logicalSwitchUuid=Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
  }
 else   if (nic.getBroadcastType() == Networks.BroadcastDomainType.Pvlan) {
    vlanId=NetUtils.getPrimaryPvlanFromUri(nic.getBroadcastUri());
  }
  String trafficLabel=nic.getName();
  if (nic.getType() == Networks.TrafficType.Guest) {
    Integer networkRateKBps=(nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
    if ((nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan || nic.getBroadcastType() == Networks.BroadcastDomainType.Pvlan) && !vlanId.equalsIgnoreCase("String_Node_Str")) {
      if (trafficLabel != null && !trafficLabel.isEmpty()) {
        s_logger.debug("String_Node_Str" + trafficLabel);
        intf.defBridgeNet(_pifs.get(trafficLabel),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
        intf.setVlanTag(Integer.parseInt(vlanId));
      }
 else {
        intf.defBridgeNet(_pifs.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
        intf.setVlanTag(Integer.parseInt(vlanId));
      }
    }
 else     if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch || nic.getBroadcastType() == Networks.BroadcastDomainType.OpenDaylight) {
      s_logger.debug("String_Node_Str" + nic + "String_Node_Str"+ logicalSwitchUuid);
      intf.setVirtualPortInterfaceId(nic.getUuid());
      String brName=(trafficLabel != null && !trafficLabel.isEmpty()) ? _pifs.get(trafficLabel) : _pifs.get("String_Node_Str");
      intf.defBridgeNet(brName,null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
    }
 else     if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vswitch) {
      String vnetId=Networks.BroadcastDomainType.getValue(nic.getBroadcastUri());
      String brName="String_Node_Str" + vnetId;
      s_logger.debug("String_Node_Str" + nic + "String_Node_Str"+ brName);
      intf.defBridgeNet(brName,null,nic.getMac(),getGuestNicModel(guestOsType),networkRateKBps);
    }
 else {
      intf.defBridgeNet(_bridges.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
    }
  }
 else   if (nic.getType() == Networks.TrafficType.Control) {
    createControlNetwork(_bridges.get("String_Node_Str"));
    intf.defBridgeNet(_bridges.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter));
  }
 else   if (nic.getType() == Networks.TrafficType.Public) {
    Integer networkRateKBps=(nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) ? nic.getNetworkRateMbps().intValue() * 128 : 0;
    if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan && !vlanId.equalsIgnoreCase("String_Node_Str")) {
      if (trafficLabel != null && !trafficLabel.isEmpty()) {
        s_logger.debug("String_Node_Str" + trafficLabel);
        intf.defBridgeNet(_pifs.get(trafficLabel),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
        intf.setVlanTag(Integer.parseInt(vlanId));
      }
 else {
        intf.defBridgeNet(_pifs.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
        intf.setVlanTag(Integer.parseInt(vlanId));
      }
    }
 else {
      intf.defBridgeNet(_bridges.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter),networkRateKBps);
    }
  }
 else   if (nic.getType() == Networks.TrafficType.Management) {
    intf.defBridgeNet(_bridges.get("String_Node_Str"),null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter));
  }
 else   if (nic.getType() == Networks.TrafficType.Storage) {
    String storageBrName=nic.getName() == null ? _bridges.get("String_Node_Str") : nic.getName();
    intf.defBridgeNet(storageBrName,null,nic.getMac(),getGuestNicModel(guestOsType,nicAdapter));
  }
  return intf;
}