Program: 106824
Project: 106824
Buggy source:
@Override public DataCenter createZone(CreateZoneCmd cmd){
  Long userId=UserContext.current().getCallerUserId();
  String zoneName=cmd.getZoneName();
  String dns1=cmd.getDns1();
  String dns2=cmd.getDns2();
  String internalDns1=cmd.getInternalDns1();
  String internalDns2=cmd.getInternalDns2();
  String vnetRange=cmd.getVlan();
  String guestCidr=cmd.getGuestCidrAddress();
  Long domainId=cmd.getDomainId();
  String type=cmd.getNetworkType();
  Boolean isBasic=false;
  String allocationState=cmd.getAllocationState();
  if (allocationState == null) {
    allocationState=Grouping.AllocationState.Enabled.toString();
  }
  if (!(type.equalsIgnoreCase(NetworkType.Basic.toString())) && !(type.equalsIgnoreCase(NetworkType.Advanced.toString()))) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else   if (type.equalsIgnoreCase(NetworkType.Basic.toString())) {
    isBasic=true;
  }
  Boolean securityGroupEnabled=cmd.isSecurityGroupEnabled();
  NetworkType zoneType=isBasic ? NetworkType.Basic : NetworkType.Advanced;
  if (zoneType == NetworkType.Advanced && guestCidr == null && !securityGroupEnabled) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else   if (zoneType == NetworkType.Basic && guestCidr != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  DomainVO domainVO=null;
  if (userId == null) {
    userId=User.UID_SYSTEM;
  }
  if (domainId != null) {
    domainVO=_domainDao.findById(domainId);
  }
  if (zoneType == NetworkType.Basic && vnetRange != null) {
    vnetRange=null;
  }
  if (zoneType == NetworkType.Basic) {
    securityGroupEnabled=true;
  }
  return createZone(userId,zoneName,dns1,dns2,internalDns1,internalDns2,vnetRange,guestCidr,domainVO != null ? domainVO.getName() : null,domainId,zoneType,securityGroupEnabled,allocationState);
}

Fixed version (ground truth):
@Override public DataCenter createZone(CreateZoneCmd cmd){
  Long userId=UserContext.current().getCallerUserId();
  String zoneName=cmd.getZoneName();
  String dns1=cmd.getDns1();
  String dns2=cmd.getDns2();
  String internalDns1=cmd.getInternalDns1();
  String internalDns2=cmd.getInternalDns2();
  String vnetRange=cmd.getVlan();
  String guestCidr=cmd.getGuestCidrAddress();
  Long domainId=cmd.getDomainId();
  String type=cmd.getNetworkType();
  Boolean isBasic=false;
  String allocationState=cmd.getAllocationState();
  String networkDomain=cmd.getDomain();
  if (allocationState == null) {
    allocationState=Grouping.AllocationState.Enabled.toString();
  }
  if (!(type.equalsIgnoreCase(NetworkType.Basic.toString())) && !(type.equalsIgnoreCase(NetworkType.Advanced.toString()))) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else   if (type.equalsIgnoreCase(NetworkType.Basic.toString())) {
    isBasic=true;
  }
  Boolean securityGroupEnabled=cmd.isSecurityGroupEnabled();
  NetworkType zoneType=isBasic ? NetworkType.Basic : NetworkType.Advanced;
  if (zoneType == NetworkType.Advanced && guestCidr == null && !securityGroupEnabled) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else   if (zoneType == NetworkType.Basic && guestCidr != null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  DomainVO domainVO=null;
  if (userId == null) {
    userId=User.UID_SYSTEM;
  }
  if (domainId != null) {
    domainVO=_domainDao.findById(domainId);
  }
  if (zoneType == NetworkType.Basic && vnetRange != null) {
    vnetRange=null;
  }
  if (zoneType == NetworkType.Basic) {
    securityGroupEnabled=true;
  }
  return createZone(userId,zoneName,dns1,dns2,internalDns1,internalDns2,vnetRange,guestCidr,domainVO != null ? domainVO.getName() : null,domainId,zoneType,securityGroupEnabled,allocationState,networkDomain);
}