Program: 106761
Project: 106761
Buggy source:
@Override public SystemVmResponse createSystemVmResponse(VirtualMachine vm){
  SystemVmResponse vmResponse=new SystemVmResponse();
  if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy) {
    vmResponse.setId(vm.getId());
    vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
    vmResponse.setZoneId(vm.getDataCenterIdToDeployIn());
    vmResponse.setName(vm.getHostName());
    vmResponse.setPodId(vm.getPodIdToDeployIn());
    vmResponse.setTemplateId(vm.getTemplateId());
    vmResponse.setCreated(vm.getCreated());
    if (vm.getHostId() != null) {
      vmResponse.setHostId(vm.getHostId());
      vmResponse.setHostName(ApiDBUtils.findHostById(vm.getHostId()).getName());
    }
    if (vm.getState() != null) {
      vmResponse.setState(vm.getState().toString());
    }
    if (vm.getType() == Type.ConsoleProxy) {
      ConsoleProxyVO proxy=ApiDBUtils.findConsoleProxy(vm.getId());
      vmResponse.setActiveViewerSessions(proxy.getActiveSession());
    }
    DataCenter zone=ApiDBUtils.findZoneById(vm.getDataCenterIdToDeployIn());
    if (zone != null) {
      vmResponse.setZoneName(zone.getName());
      vmResponse.setDns1(zone.getDns1());
      vmResponse.setDns2(zone.getDns2());
    }
    List<NicProfile> nicProfiles=ApiDBUtils.getNics(vm);
    for (    NicProfile singleNicProfile : nicProfiles) {
      Network network=ApiDBUtils.findNetworkById(singleNicProfile.getNetworkId());
      if (network != null) {
        TrafficType trafficType=TrafficType.Public;
        if (zone.getNetworkType() == NetworkType.Basic || zone.isSecurityGroupEnabled()) {
          trafficType=TrafficType.Guest;
        }
        if (network.getTrafficType() == trafficType) {
          vmResponse.setPublicIp(singleNicProfile.getIp4Address());
          vmResponse.setPublicMacAddress(singleNicProfile.getMacAddress());
          vmResponse.setPublicNetmask(singleNicProfile.getNetmask());
          vmResponse.setGateway(singleNicProfile.getGateway());
        }
 else         if (network.getTrafficType() == TrafficType.Management) {
          vmResponse.setPrivateIp(singleNicProfile.getIp4Address());
          vmResponse.setPrivateMacAddress(singleNicProfile.getMacAddress());
          vmResponse.setPrivateNetmask(singleNicProfile.getNetmask());
        }
 else         if (network.getTrafficType() == TrafficType.Control) {
          vmResponse.setLinkLocalIp(singleNicProfile.getIp4Address());
          vmResponse.setLinkLocalMacAddress(singleNicProfile.getMacAddress());
          vmResponse.setLinkLocalNetmask(singleNicProfile.getNetmask());
        }
      }
    }
  }
  vmResponse.setObjectName("String_Node_Str");
  return vmResponse;
}

Fixed version (ground truth):
@Override public SystemVmResponse createSystemVmResponse(VirtualMachine vm){
  SystemVmResponse vmResponse=new SystemVmResponse();
  if (vm.getType() == Type.SecondaryStorageVm || vm.getType() == Type.ConsoleProxy) {
    vmResponse.setId(vm.getId());
    vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
    vmResponse.setZoneId(vm.getDataCenterIdToDeployIn());
    vmResponse.setName(vm.getHostName());
    vmResponse.setPodId(vm.getPodIdToDeployIn());
    vmResponse.setTemplateId(vm.getTemplateId());
    vmResponse.setCreated(vm.getCreated());
    if (vm.getHostId() != null) {
      vmResponse.setHostId(vm.getHostId());
      vmResponse.setHostName(ApiDBUtils.findHostById(vm.getHostId()).getName());
    }
    if (vm.getState() != null) {
      vmResponse.setState(vm.getState().toString());
    }
    if (vm.getType() == Type.ConsoleProxy) {
      ConsoleProxyVO proxy=ApiDBUtils.findConsoleProxy(vm.getId());
      if (proxy != null) {
        vmResponse.setActiveViewerSessions(proxy.getActiveSession());
      }
    }
    DataCenter zone=ApiDBUtils.findZoneById(vm.getDataCenterIdToDeployIn());
    if (zone != null) {
      vmResponse.setZoneName(zone.getName());
      vmResponse.setDns1(zone.getDns1());
      vmResponse.setDns2(zone.getDns2());
    }
    List<NicProfile> nicProfiles=ApiDBUtils.getNics(vm);
    for (    NicProfile singleNicProfile : nicProfiles) {
      Network network=ApiDBUtils.findNetworkById(singleNicProfile.getNetworkId());
      if (network != null) {
        TrafficType trafficType=TrafficType.Public;
        if (zone.getNetworkType() == NetworkType.Basic || zone.isSecurityGroupEnabled()) {
          trafficType=TrafficType.Guest;
        }
        if (network.getTrafficType() == trafficType) {
          vmResponse.setPublicIp(singleNicProfile.getIp4Address());
          vmResponse.setPublicMacAddress(singleNicProfile.getMacAddress());
          vmResponse.setPublicNetmask(singleNicProfile.getNetmask());
          vmResponse.setGateway(singleNicProfile.getGateway());
        }
 else         if (network.getTrafficType() == TrafficType.Management) {
          vmResponse.setPrivateIp(singleNicProfile.getIp4Address());
          vmResponse.setPrivateMacAddress(singleNicProfile.getMacAddress());
          vmResponse.setPrivateNetmask(singleNicProfile.getNetmask());
        }
 else         if (network.getTrafficType() == TrafficType.Control) {
          vmResponse.setLinkLocalIp(singleNicProfile.getIp4Address());
          vmResponse.setLinkLocalMacAddress(singleNicProfile.getMacAddress());
          vmResponse.setLinkLocalNetmask(singleNicProfile.getNetmask());
        }
      }
    }
  }
  vmResponse.setObjectName("String_Node_Str");
  return vmResponse;
}