Program: 107292
Project: 107292
Buggy source:
@Override public SystemVmResponse createSystemVmResponse(VirtualMachine systemVM){
  SystemVmResponse vmResponse=new SystemVmResponse();
  if (systemVM instanceof SystemVm) {
    SystemVm vm=(SystemVm)systemVM;
    vmResponse.setId(vm.getId());
    vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
    vmResponse.setZoneId(vm.getDataCenterId());
    vmResponse.setNetworkDomain(vm.getDomain());
    vmResponse.setName(vm.getHostName());
    vmResponse.setPodId(vm.getPodId());
    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());
    }
    String instanceType="String_Node_Str";
    if (systemVM instanceof SecondaryStorageVmVO) {
      instanceType="String_Node_Str";
    }
    if (systemVM instanceof ConsoleProxyVO) {
      ConsoleProxyVO proxy=(ConsoleProxyVO)systemVM;
      vmResponse.setActiveViewerSessions(proxy.getActiveSession());
    }
    DataCenter zone=ApiDBUtils.findZoneById(vm.getDataCenterId());
    if (zone != null) {
      vmResponse.setZoneName(zone.getName());
      vmResponse.setDns1(zone.getDns1());
      vmResponse.setDns2(zone.getDns2());
    }
    List<? extends Nic> nics=ApiDBUtils.getNics(systemVM);
    for (    Nic singleNic : nics) {
      Network network=ApiDBUtils.findNetworkById(singleNic.getNetworkId());
      if (network != null) {
        if (network.getTrafficType() == TrafficType.Public) {
          vmResponse.setPublicIp(singleNic.getIp4Address());
          vmResponse.setPublicMacAddress(singleNic.getMacAddress());
          vmResponse.setPublicNetmask(singleNic.getNetmask());
        }
 else         if (network.getTrafficType() == TrafficType.Control) {
          vmResponse.setPrivateIp(singleNic.getIp4Address());
          vmResponse.setPrivateMacAddress(singleNic.getMacAddress());
          vmResponse.setPrivateNetmask(singleNic.getNetmask());
        }
      }
    }
  }
  vmResponse.setObjectName("String_Node_Str");
  return vmResponse;
}

Fixed version (ground truth):
@Override public SystemVmResponse createSystemVmResponse(VirtualMachine systemVM){
  SystemVmResponse vmResponse=new SystemVmResponse();
  if (systemVM instanceof SystemVm) {
    SystemVm vm=(SystemVm)systemVM;
    vmResponse.setId(vm.getId());
    vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
    vmResponse.setZoneId(vm.getDataCenterId());
    vmResponse.setNetworkDomain(vm.getDomain());
    vmResponse.setName(vm.getName());
    vmResponse.setPodId(vm.getPodId());
    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());
    }
    String instanceType="String_Node_Str";
    if (systemVM instanceof SecondaryStorageVmVO) {
      instanceType="String_Node_Str";
    }
    if (systemVM instanceof ConsoleProxyVO) {
      ConsoleProxyVO proxy=(ConsoleProxyVO)systemVM;
      vmResponse.setActiveViewerSessions(proxy.getActiveSession());
    }
    DataCenter zone=ApiDBUtils.findZoneById(vm.getDataCenterId());
    if (zone != null) {
      vmResponse.setZoneName(zone.getName());
      vmResponse.setDns1(zone.getDns1());
      vmResponse.setDns2(zone.getDns2());
    }
    List<? extends Nic> nics=ApiDBUtils.getNics(systemVM);
    for (    Nic singleNic : nics) {
      Network network=ApiDBUtils.findNetworkById(singleNic.getNetworkId());
      if (network != null) {
        if (network.getTrafficType() == TrafficType.Public) {
          vmResponse.setPublicIp(singleNic.getIp4Address());
          vmResponse.setPublicMacAddress(singleNic.getMacAddress());
          vmResponse.setPublicNetmask(singleNic.getNetmask());
        }
 else         if (network.getTrafficType() == TrafficType.Control) {
          vmResponse.setPrivateIp(singleNic.getIp4Address());
          vmResponse.setPrivateMacAddress(singleNic.getMacAddress());
          vmResponse.setPrivateNetmask(singleNic.getNetmask());
        }
      }
    }
  }
  vmResponse.setObjectName("String_Node_Str");
  return vmResponse;
}