Program: 106965
Project: 106965
Buggy source:
@Override public NetworkResponse createNetworkResponse(Network network){
  NetworkProfile profile=ApiDBUtils.getNetworkProfile(network.getId());
  NetworkResponse response=new NetworkResponse();
  response.setId(network.getId());
  response.setName(network.getName());
  response.setDisplaytext(network.getDisplayText());
  if (network.getBroadcastDomainType() != null) {
    response.setBroadcastDomainType(network.getBroadcastDomainType().toString());
  }
  if (network.getBroadcastUri() != null) {
    response.setBroadcastUri(network.getBroadcastUri().toString());
  }
  if (network.getTrafficType() != null) {
    response.setTrafficType(network.getTrafficType().name());
  }
  if (network.getGuestType() != null) {
    response.setType(network.getGuestType().name());
  }
  List<? extends Vlan> vlan=ApiDBUtils.listVlanByNetworkId(network.getId());
  if (vlan != null && !vlan.isEmpty()) {
    Vlan singleVlan=vlan.get(0);
    String ipRange=singleVlan.getIpRange();
    String[] range=ipRange.split("String_Node_Str");
    response.setStartIp(range[0]);
    response.setEndIp(range[1]);
    response.setGateway(singleVlan.getVlanGateway());
    response.setNetmask(singleVlan.getVlanNetmask());
    response.setVlan(singleVlan.getVlanTag());
  }
  response.setZoneId(network.getDataCenterId());
  NetworkOffering networkOffering=ApiDBUtils.findNetworkOfferingById(network.getNetworkOfferingId());
  if (networkOffering != null) {
    response.setNetworkOfferingId(networkOffering.getId());
    response.setNetworkOfferingName(networkOffering.getName());
    response.setNetworkOfferingDisplayText(networkOffering.getDisplayText());
    response.setIsSystem(networkOffering.isSystemOnly());
    response.setNetworkOfferingAvailability(networkOffering.getAvailability().toString());
  }
  response.setIsShared(network.getIsShared());
  response.setIsDefault(network.isDefault());
  response.setState(network.getState().toString());
  response.setRelated(network.getRelated());
  response.setNetworkDomain(network.getNetworkDomain());
  response.setDns1(profile.getDns1());
  response.setDns2(profile.getDns2());
  response.setIsSecurityGroupEnabled(network.isSecurityGroupEnabled());
  response.setTags(network.getTags());
  Map<Service,Map<Capability,String>> serviceCapabilitiesMap=ApiDBUtils.getNetworkCapabilities(network.getId());
  List<ServiceResponse> serviceResponses=new ArrayList<ServiceResponse>();
  if (serviceCapabilitiesMap != null) {
    for (    Service service : serviceCapabilitiesMap.keySet()) {
      ServiceResponse serviceResponse=new ServiceResponse();
      serviceResponse.setName(service.getName());
      List<CapabilityResponse> capabilityResponses=new ArrayList<CapabilityResponse>();
      Map<Capability,String> serviceCapabilities=serviceCapabilitiesMap.get(service);
      if (serviceCapabilities != null) {
        for (        Capability capability : serviceCapabilities.keySet()) {
          CapabilityResponse capabilityResponse=new CapabilityResponse();
          String capabilityValue=serviceCapabilities.get(capability);
          capabilityResponse.setName(capability.getName());
          capabilityResponse.setValue(capabilityValue);
          capabilityResponse.setObjectName("String_Node_Str");
          capabilityResponses.add(capabilityResponse);
        }
        serviceResponse.setCapabilities(capabilityResponses);
      }
      serviceResponse.setObjectName("String_Node_Str");
      serviceResponses.add(serviceResponse);
    }
  }
  response.setServices(serviceResponses);
  Account account=ApiDBUtils.findAccountById(network.getAccountId());
  if (account != null && !network.getIsShared()) {
    response.setAccountName(account.getAccountName());
    Domain domain=ApiDBUtils.findDomainById(account.getDomainId());
    response.setDomainId(domain.getId());
    response.setDomain(domain.getName());
  }
  Long dedicatedDomainId=ApiDBUtils.getDedicatedNetworkDomain(network.getId());
  if (dedicatedDomainId != null) {
    Domain domain=ApiDBUtils.findDomainById(dedicatedDomainId);
    response.setDomainId(dedicatedDomainId);
    response.setDomain(domain.getName());
  }
  response.setObjectName("String_Node_Str");
  return response;
}

Fixed version (ground truth):
@Override public NetworkResponse createNetworkResponse(Network network){
  NetworkProfile profile=ApiDBUtils.getNetworkProfile(network.getId());
  NetworkResponse response=new NetworkResponse();
  response.setId(network.getId());
  response.setName(network.getName());
  response.setDisplaytext(network.getDisplayText());
  if (network.getBroadcastDomainType() != null) {
    response.setBroadcastDomainType(network.getBroadcastDomainType().toString());
  }
  if (network.getBroadcastUri() != null) {
    response.setBroadcastUri(network.getBroadcastUri().toString());
  }
  if (network.getTrafficType() != null) {
    response.setTrafficType(network.getTrafficType().name());
  }
  if (network.getGuestType() != null) {
    response.setType(network.getGuestType().name());
  }
  List<? extends Vlan> vlan=ApiDBUtils.listVlanByNetworkId(network.getId());
  if (vlan != null && !vlan.isEmpty()) {
    Vlan singleVlan=vlan.get(0);
    String ipRange=singleVlan.getIpRange();
    String[] range=ipRange.split("String_Node_Str");
    response.setStartIp(range[0]);
    response.setEndIp(range[1]);
    response.setGateway(singleVlan.getVlanGateway());
    response.setNetmask(singleVlan.getVlanNetmask());
    response.setVlan(singleVlan.getVlanTag());
  }
  response.setZoneId(network.getDataCenterId());
  NetworkOffering networkOffering=ApiDBUtils.findNetworkOfferingById(network.getNetworkOfferingId());
  if (networkOffering != null) {
    response.setNetworkOfferingId(networkOffering.getId());
    response.setNetworkOfferingName(networkOffering.getName());
    response.setNetworkOfferingDisplayText(networkOffering.getDisplayText());
    response.setIsSystem(networkOffering.isSystemOnly());
    response.setNetworkOfferingAvailability(networkOffering.getAvailability().toString());
  }
  response.setIsShared(network.getIsShared());
  response.setIsDefault(network.isDefault());
  response.setState(network.getState().toString());
  response.setRelated(network.getRelated());
  response.setNetworkDomain(network.getNetworkDomain());
  response.setDns1(profile.getDns1());
  response.setDns2(profile.getDns2());
  response.setIsSecurityGroupEnabled(network.isSecurityGroupEnabled());
  response.setTags(network.getTags());
  Map<Service,Map<Capability,String>> serviceCapabilitiesMap=ApiDBUtils.getNetworkCapabilities(networkOffering.getId(),network.getDataCenterId());
  List<ServiceResponse> serviceResponses=new ArrayList<ServiceResponse>();
  if (serviceCapabilitiesMap != null) {
    for (    Service service : serviceCapabilitiesMap.keySet()) {
      ServiceResponse serviceResponse=new ServiceResponse();
      serviceResponse.setName(service.getName());
      List<CapabilityResponse> capabilityResponses=new ArrayList<CapabilityResponse>();
      Map<Capability,String> serviceCapabilities=serviceCapabilitiesMap.get(service);
      if (serviceCapabilities != null) {
        for (        Capability capability : serviceCapabilities.keySet()) {
          CapabilityResponse capabilityResponse=new CapabilityResponse();
          String capabilityValue=serviceCapabilities.get(capability);
          capabilityResponse.setName(capability.getName());
          capabilityResponse.setValue(capabilityValue);
          capabilityResponse.setObjectName("String_Node_Str");
          capabilityResponses.add(capabilityResponse);
        }
        serviceResponse.setCapabilities(capabilityResponses);
      }
      serviceResponse.setObjectName("String_Node_Str");
      serviceResponses.add(serviceResponse);
    }
  }
  response.setServices(serviceResponses);
  Account account=ApiDBUtils.findAccountById(network.getAccountId());
  if (account != null && !network.getIsShared()) {
    response.setAccountName(account.getAccountName());
    Domain domain=ApiDBUtils.findDomainById(account.getDomainId());
    response.setDomainId(domain.getId());
    response.setDomain(domain.getName());
  }
  Long dedicatedDomainId=ApiDBUtils.getDedicatedNetworkDomain(network.getId());
  if (dedicatedDomainId != null) {
    Domain domain=ApiDBUtils.findDomainById(dedicatedDomainId);
    response.setDomainId(dedicatedDomainId);
    response.setDomain(domain.getName());
  }
  response.setObjectName("String_Node_Str");
  return response;
}