Program: 105208
Project: 105208
Buggy source:
@Override public IPAddressResponse createIPAddressResponse(ResponseView view,IpAddress ipAddr){
  VlanVO vlan=ApiDBUtils.findVlanById(ipAddr.getVlanId());
  boolean forVirtualNetworks=vlan.getVlanType().equals(VlanType.VirtualNetwork);
  long zoneId=ipAddr.getDataCenterId();
  IPAddressResponse ipResponse=new IPAddressResponse();
  ipResponse.setId(ipAddr.getUuid());
  ipResponse.setIpAddress(ipAddr.getAddress().toString());
  if (ipAddr.getAllocatedTime() != null) {
    ipResponse.setAllocated(ipAddr.getAllocatedTime());
  }
  DataCenter zone=ApiDBUtils.findZoneById(ipAddr.getDataCenterId());
  if (zone != null) {
    ipResponse.setZoneId(zone.getUuid());
    ipResponse.setZoneName(zone.getName());
  }
  ipResponse.setSourceNat(ipAddr.isSourceNat());
  ipResponse.setIsSystem(ipAddr.getSystem());
  if (ipAddr.getAllocatedToAccountId() != null) {
    populateOwner(ipResponse,ipAddr);
  }
  ipResponse.setForVirtualNetwork(forVirtualNetworks);
  ipResponse.setStaticNat(ipAddr.isOneToOneNat());
  if (ipAddr.getAssociatedWithVmId() != null) {
    UserVm vm=ApiDBUtils.findUserVmById(ipAddr.getAssociatedWithVmId());
    if (vm != null) {
      ipResponse.setVirtualMachineId(vm.getUuid());
      ipResponse.setVirtualMachineName(vm.getHostName());
      if (vm.getDisplayName() != null) {
        ipResponse.setVirtualMachineDisplayName(vm.getDisplayName());
      }
 else {
        ipResponse.setVirtualMachineDisplayName(vm.getHostName());
      }
    }
  }
  if (ipAddr.getVmIp() != null) {
    ipResponse.setVirtualMachineIp(ipAddr.getVmIp());
  }
  if (ipAddr.getAssociatedWithNetworkId() != null) {
    Network ntwk=ApiDBUtils.findNetworkById(ipAddr.getAssociatedWithNetworkId());
    if (ntwk != null) {
      ipResponse.setAssociatedNetworkId(ntwk.getUuid());
      ipResponse.setAssociatedNetworkName(ntwk.getName());
    }
  }
  if (ipAddr.getVpcId() != null) {
    Vpc vpc=ApiDBUtils.findVpcById(ipAddr.getVpcId());
    if (vpc != null) {
      ipResponse.setVpcId(vpc.getUuid());
    }
  }
  Long vlanNetworkId=ApiDBUtils.getVlanNetworkId(ipAddr.getVlanId());
  Long networkId;
  if (vlanNetworkId != null) {
    networkId=vlanNetworkId;
  }
 else {
    networkId=ApiDBUtils.getPublicNetworkIdByZone(zoneId);
  }
  if (networkId != null) {
    NetworkVO nw=ApiDBUtils.findNetworkById(networkId);
    if (nw != null) {
      ipResponse.setNetworkId(nw.getUuid());
    }
  }
  ipResponse.setState(ipAddr.getState().toString());
  if (ipAddr.getPhysicalNetworkId() != null) {
    PhysicalNetworkVO pnw=ApiDBUtils.findPhysicalNetworkById(ipAddr.getPhysicalNetworkId());
    if (pnw != null) {
      ipResponse.setPhysicalNetworkId(pnw.getUuid());
    }
  }
  if (view == ResponseView.Full) {
    VlanVO vl=ApiDBUtils.findVlanById(ipAddr.getVlanId());
    if (vl != null) {
      ipResponse.setVlanId(vl.getUuid());
      ipResponse.setVlanName(vl.getVlanTag());
    }
  }
  if (ipAddr.getSystem()) {
    if (ipAddr.isOneToOneNat()) {
      ipResponse.setPurpose(IpAddress.Purpose.StaticNat.toString());
    }
 else {
      ipResponse.setPurpose(IpAddress.Purpose.Lb.toString());
    }
  }
  ipResponse.setForDisplay(ipAddr.isDisplay());
  ipResponse.setPortable(ipAddr.isPortable());
  List<? extends ResourceTag> tags=ApiDBUtils.listByResourceTypeAndId(ResourceObjectType.PublicIpAddress,ipAddr.getId());
  List<ResourceTagResponse> tagResponses=new ArrayList<ResourceTagResponse>();
  for (  ResourceTag tag : tags) {
    ResourceTagResponse tagResponse=createResourceTagResponse(tag,true);
    tagResponses.add(tagResponse);
  }
  ipResponse.setTags(tagResponses);
  ipResponse.setObjectName("String_Node_Str");
  return ipResponse;
}

Fixed version (ground truth):
@Override public IPAddressResponse createIPAddressResponse(ResponseView view,IpAddress ipAddr){
  VlanVO vlan=ApiDBUtils.findVlanById(ipAddr.getVlanId());
  boolean forVirtualNetworks=vlan.getVlanType().equals(VlanType.VirtualNetwork);
  long zoneId=ipAddr.getDataCenterId();
  IPAddressResponse ipResponse=new IPAddressResponse();
  ipResponse.setId(ipAddr.getUuid());
  ipResponse.setIpAddress(ipAddr.getAddress().toString());
  if (ipAddr.getAllocatedTime() != null) {
    ipResponse.setAllocated(ipAddr.getAllocatedTime());
  }
  DataCenter zone=ApiDBUtils.findZoneById(ipAddr.getDataCenterId());
  if (zone != null) {
    ipResponse.setZoneId(zone.getUuid());
    ipResponse.setZoneName(zone.getName());
  }
  ipResponse.setSourceNat(ipAddr.isSourceNat());
  ipResponse.setIsSystem(ipAddr.getSystem());
  if (ipAddr.getAllocatedToAccountId() != null) {
    populateOwner(ipResponse,ipAddr);
  }
  ipResponse.setForVirtualNetwork(forVirtualNetworks);
  ipResponse.setStaticNat(ipAddr.isOneToOneNat());
  if (ipAddr.getAssociatedWithVmId() != null) {
    UserVm vm=ApiDBUtils.findUserVmById(ipAddr.getAssociatedWithVmId());
    if (vm != null) {
      ipResponse.setVirtualMachineId(vm.getUuid());
      ipResponse.setVirtualMachineName(vm.getHostName());
      if (vm.getDisplayName() != null) {
        ipResponse.setVirtualMachineDisplayName(vm.getDisplayName());
      }
 else {
        ipResponse.setVirtualMachineDisplayName(vm.getHostName());
      }
    }
  }
  if (ipAddr.getVmIp() != null) {
    ipResponse.setVirtualMachineIp(ipAddr.getVmIp());
  }
  if (ipAddr.getAssociatedWithNetworkId() != null) {
    Network ntwk=ApiDBUtils.findNetworkById(ipAddr.getAssociatedWithNetworkId());
    if (ntwk != null) {
      ipResponse.setAssociatedNetworkId(ntwk.getUuid());
      ipResponse.setAssociatedNetworkName(ntwk.getName());
    }
  }
  if (ipAddr.getVpcId() != null) {
    Vpc vpc=ApiDBUtils.findVpcById(ipAddr.getVpcId());
    if (vpc != null) {
      ipResponse.setVpcId(vpc.getUuid());
    }
  }
  Long vlanNetworkId=ApiDBUtils.getVlanNetworkId(ipAddr.getVlanId());
  Long networkId;
  if (vlanNetworkId != null) {
    networkId=vlanNetworkId;
  }
 else {
    networkId=ApiDBUtils.getPublicNetworkIdByZone(zoneId);
  }
  if (networkId != null) {
    NetworkVO nw=ApiDBUtils.findNetworkById(networkId);
    if (nw != null) {
      ipResponse.setNetworkId(nw.getUuid());
    }
  }
  ipResponse.setState(ipAddr.getState().toString());
  if (ipAddr.getPhysicalNetworkId() != null) {
    PhysicalNetworkVO pnw=ApiDBUtils.findPhysicalNetworkById(ipAddr.getPhysicalNetworkId());
    if (pnw != null) {
      ipResponse.setPhysicalNetworkId(pnw.getUuid());
    }
  }
  if (view == ResponseView.Full) {
    VlanVO vl=ApiDBUtils.findVlanById(ipAddr.getVlanId());
    if (vl != null) {
      ipResponse.setVlanId(vl.getUuid());
      ipResponse.setVlanName(vl.getVlanTag());
    }
  }
  if (ipAddr.getSystem()) {
    if (ipAddr.isOneToOneNat()) {
      ipResponse.setPurpose(IpAddress.Purpose.StaticNat.toString());
    }
 else {
      ipResponse.setPurpose(IpAddress.Purpose.Lb.toString());
    }
  }
  ipResponse.setForDisplay(ipAddr.isDisplay());
  ipResponse.setPortable(ipAddr.isPortable());
  List<? extends ResourceTag> tags=ApiDBUtils.listByResourceTypeAndId(ResourceObjectType.PublicIpAddress,ipAddr.getId());
  List<ResourceTagResponse> tagResponses=new ArrayList<ResourceTagResponse>();
  for (  ResourceTag tag : tags) {
    ResourceTagResponse tagResponse=createResourceTagResponse(tag,true);
    CollectionUtils.addIgnoreNull(tagResponses,tagResponse);
  }
  ipResponse.setTags(tagResponses);
  ipResponse.setObjectName("String_Node_Str");
  return ipResponse;
}