Program: 106020
Project: 106020
Buggy source:
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_TRAFFIC_TYPE_CREATE,eventDescription="String_Node_Str",create=true) public PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId,String trafficTypeStr,String xenLabel,String kvmLabel,String vmwareLabel,String simulatorLabel,String vlan,String hypervLabel){
  PhysicalNetworkVO network=_physicalNetworkDao.findById(physicalNetworkId);
  if (network == null) {
    throw new InvalidParameterValueException("String_Node_Str" + physicalNetworkId + "String_Node_Str");
  }
  Networks.TrafficType trafficType=null;
  if (trafficTypeStr != null && !trafficTypeStr.isEmpty()) {
    try {
      trafficType=Networks.TrafficType.valueOf(trafficTypeStr);
    }
 catch (    IllegalArgumentException ex) {
      throw new InvalidParameterValueException("String_Node_Str" + trafficTypeStr + "String_Node_Str");
    }
  }
  if (_pNTrafficTypeDao.isTrafficTypeSupported(physicalNetworkId,trafficType)) {
    throw new CloudRuntimeException("String_Node_Str" + trafficType);
  }
  if (TrafficType.isSystemNetwork(trafficType) || TrafficType.Public.equals(trafficType) || TrafficType.Storage.equals(trafficType)) {
    if (!_physicalNetworkDao.listByZoneAndTrafficType(network.getDataCenterId(),trafficType).isEmpty()) {
      throw new CloudRuntimeException("String_Node_Str" + trafficType);
    }
  }
  if (TrafficType.Storage.equals(trafficType)) {
    List<SecondaryStorageVmVO> ssvms=_stnwMgr.getSSVMWithNoStorageNetwork(network.getDataCenterId());
    if (!ssvms.isEmpty()) {
      StringBuilder sb=new StringBuilder("String_Node_Str" + trafficType + "String_Node_Str");
      sb.append("String_Node_Str");
      for (      SecondaryStorageVmVO ssvm : ssvms) {
        sb.append(ssvm.getInstanceName()).append("String_Node_Str").append(ssvm.getState());
      }
      throw new CloudRuntimeException(sb.toString());
    }
  }
  try {
    if (xenLabel == null) {
      xenLabel=getDefaultXenNetworkLabel(trafficType);
    }
    PhysicalNetworkTrafficTypeVO pNetworktrafficType=new PhysicalNetworkTrafficTypeVO(physicalNetworkId,trafficType,xenLabel,kvmLabel,vmwareLabel,simulatorLabel,vlan,hypervLabel);
    pNetworktrafficType=_pNTrafficTypeDao.persist(pNetworktrafficType);
    return pNetworktrafficType;
  }
 catch (  Exception ex) {
    s_logger.warn("String_Node_Str",ex);
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_TRAFFIC_TYPE_CREATE,eventDescription="String_Node_Str",create=true) public PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId,String trafficTypeStr,String isolationMethod,String xenLabel,String kvmLabel,String vmwareLabel,String simulatorLabel,String vlan,String hypervLabel){
  PhysicalNetworkVO network=_physicalNetworkDao.findById(physicalNetworkId);
  if (network == null) {
    throw new InvalidParameterValueException("String_Node_Str" + physicalNetworkId + "String_Node_Str");
  }
  Networks.TrafficType trafficType=null;
  if (trafficTypeStr != null && !trafficTypeStr.isEmpty()) {
    try {
      trafficType=Networks.TrafficType.valueOf(trafficTypeStr);
    }
 catch (    IllegalArgumentException ex) {
      throw new InvalidParameterValueException("String_Node_Str" + trafficTypeStr + "String_Node_Str");
    }
  }
  if (_pNTrafficTypeDao.isTrafficTypeSupported(physicalNetworkId,trafficType)) {
    throw new CloudRuntimeException("String_Node_Str" + trafficType);
  }
  if (TrafficType.isSystemNetwork(trafficType) || TrafficType.Public.equals(trafficType) || TrafficType.Storage.equals(trafficType)) {
    if (!_physicalNetworkDao.listByZoneAndTrafficType(network.getDataCenterId(),trafficType).isEmpty()) {
      throw new CloudRuntimeException("String_Node_Str" + trafficType);
    }
  }
  if (TrafficType.Storage.equals(trafficType)) {
    List<SecondaryStorageVmVO> ssvms=_stnwMgr.getSSVMWithNoStorageNetwork(network.getDataCenterId());
    if (!ssvms.isEmpty()) {
      StringBuilder sb=new StringBuilder("String_Node_Str" + trafficType + "String_Node_Str");
      sb.append("String_Node_Str");
      for (      SecondaryStorageVmVO ssvm : ssvms) {
        sb.append(ssvm.getInstanceName()).append("String_Node_Str").append(ssvm.getState());
      }
      throw new CloudRuntimeException(sb.toString());
    }
  }
  try {
    if (xenLabel == null) {
      xenLabel=getDefaultXenNetworkLabel(trafficType);
    }
    PhysicalNetworkTrafficTypeVO pNetworktrafficType=new PhysicalNetworkTrafficTypeVO(physicalNetworkId,trafficType,xenLabel,kvmLabel,vmwareLabel,simulatorLabel,vlan,hypervLabel);
    pNetworktrafficType=_pNTrafficTypeDao.persist(pNetworktrafficType);
    List<String> isolationMethods=network.getIsolationMethods();
    if ((isolationMethods.size() == 1 && isolationMethods.get(0).toLowerCase().equals("String_Node_Str")) || (isolationMethod != null && isolationMethods.contains(isolationMethod) && isolationMethod.toLowerCase().equals("String_Node_Str"))) {
      NetworkVO publicNetwork=_networksDao.listByZoneAndTrafficType(network.getDataCenterId(),TrafficType.Public).get(0);
      if (publicNetwork != null) {
        s_logger.debug("String_Node_Str" + publicNetwork + "String_Node_Str");
        publicNetwork.setBroadcastDomainType(BroadcastDomainType.Vxlan);
        _networksDao.persist(publicNetwork);
      }
    }
    return pNetworktrafficType;
  }
 catch (  Exception ex) {
    s_logger.warn("String_Node_Str",ex);
    throw new CloudRuntimeException("String_Node_Str");
  }
}