Program: 89925
Project: 89925
Buggy source:
public static VMOperationResultObject composeResultObject(ManagementServer managementServer,UserVmVO vm,String vmPassword){
  VMOperationResultObject resultObject=new VMOperationResultObject();
  resultObject.setId(vm.getId());
  resultObject.setName(vm.getHostName());
  resultObject.setCreated(vm.getCreated());
  resultObject.setZoneId(vm.getDataCenterId());
  resultObject.setZoneName(managementServer.findDataCenterById(vm.getDataCenterId()).getName());
  resultObject.setIpAddress(vm.getPrivateIpAddress());
  resultObject.setServiceOfferingId(vm.getServiceOfferingId());
  resultObject.setHaEnabled(vm.isHaEnabled());
  if (vm.getDisplayName() == null || vm.getDisplayName().length() == 0) {
    resultObject.setDisplayName(vm.getHostName());
  }
 else {
    resultObject.setDisplayName(vm.getDisplayName());
  }
  if (vm.getState() != null)   resultObject.setState(vm.getState().toString());
  VMTemplateVO template=managementServer.findTemplateById(vm.getTemplateId());
  Account acct=managementServer.findAccountById(Long.valueOf(vm.getAccountId()));
  if (acct != null) {
    resultObject.setAccount(acct.getAccountName());
    resultObject.setDomainId(acct.getDomainId());
  }
  if (BaseCmd.isAdmin(acct.getType()) && (vm.getHostId() != null)) {
    resultObject.setHostname(managementServer.getHostBy(vm.getHostId()).getName());
    resultObject.setHostid(vm.getHostId());
  }
  String templateName="String_Node_Str";
  boolean templatePasswordEnabled=false;
  String templateDisplayText="String_Node_Str";
  if (template != null) {
    templateName=template.getName();
    templatePasswordEnabled=template.getEnablePassword();
    templateDisplayText=template.getDisplayText();
    if (templateDisplayText == null) {
      templateDisplayText=templateName;
    }
  }
  resultObject.setTemplateId(vm.getTemplateId());
  resultObject.setTemplateName(templateName);
  resultObject.setTemplateDisplayText(templateDisplayText);
  resultObject.setPasswordEnabled(templatePasswordEnabled);
  if (templatePasswordEnabled)   resultObject.setPassword(vmPassword);
  String isoName=null;
  if (vm.getIsoId() != null) {
    VMTemplateVO iso=managementServer.findTemplateById(vm.getIsoId().longValue());
    if (iso != null) {
      isoName=iso.getName();
    }
  }
  resultObject.setIsoId(vm.getIsoId());
  resultObject.setIsoName(isoName);
  ServiceOfferingVO offering=managementServer.findServiceOfferingById(vm.getServiceOfferingId());
  resultObject.setServiceOfferingId(vm.getServiceOfferingId());
  resultObject.setServiceOfferingName(offering.getName());
  resultObject.setCpuNumber(String.valueOf(offering.getCpu()));
  resultObject.setCpuSpeed(String.valueOf(offering.getSpeed()));
  resultObject.setMemory(String.valueOf(offering.getRamSize()));
  return resultObject;
}

Fixed version (ground truth):
public static VMOperationResultObject composeResultObject(ManagementServer managementServer,UserVmVO vm,String vmPassword){
  VMOperationResultObject resultObject=new VMOperationResultObject();
  resultObject.setId(vm.getId());
  resultObject.setName(vm.getName());
  resultObject.setCreated(vm.getCreated());
  resultObject.setZoneId(vm.getDataCenterId());
  resultObject.setZoneName(managementServer.findDataCenterById(vm.getDataCenterId()).getName());
  resultObject.setIpAddress(vm.getPrivateIpAddress());
  resultObject.setServiceOfferingId(vm.getServiceOfferingId());
  resultObject.setHaEnabled(vm.isHaEnabled());
  if (vm.getDisplayName() == null || vm.getDisplayName().length() == 0) {
    resultObject.setDisplayName(vm.getName());
  }
 else {
    resultObject.setDisplayName(vm.getDisplayName());
  }
  if (vm.getState() != null)   resultObject.setState(vm.getState().toString());
  VMTemplateVO template=managementServer.findTemplateById(vm.getTemplateId());
  Account acct=managementServer.findAccountById(Long.valueOf(vm.getAccountId()));
  if (acct != null) {
    resultObject.setAccount(acct.getAccountName());
    resultObject.setDomainId(acct.getDomainId());
  }
  if (BaseCmd.isAdmin(acct.getType()) && (vm.getHostId() != null)) {
    resultObject.setHostname(managementServer.getHostBy(vm.getHostId()).getName());
    resultObject.setHostid(vm.getHostId());
  }
  String templateName="String_Node_Str";
  boolean templatePasswordEnabled=false;
  String templateDisplayText="String_Node_Str";
  if (template != null) {
    templateName=template.getName();
    templatePasswordEnabled=template.getEnablePassword();
    templateDisplayText=template.getDisplayText();
    if (templateDisplayText == null) {
      templateDisplayText=templateName;
    }
  }
  resultObject.setTemplateId(vm.getTemplateId());
  resultObject.setTemplateName(templateName);
  resultObject.setTemplateDisplayText(templateDisplayText);
  resultObject.setPasswordEnabled(templatePasswordEnabled);
  if (templatePasswordEnabled)   resultObject.setPassword(vmPassword);
  String isoName=null;
  if (vm.getIsoId() != null) {
    VMTemplateVO iso=managementServer.findTemplateById(vm.getIsoId().longValue());
    if (iso != null) {
      isoName=iso.getName();
    }
  }
  resultObject.setIsoId(vm.getIsoId());
  resultObject.setIsoName(isoName);
  ServiceOfferingVO offering=managementServer.findServiceOfferingById(vm.getServiceOfferingId());
  resultObject.setServiceOfferingId(vm.getServiceOfferingId());
  resultObject.setServiceOfferingName(offering.getName());
  resultObject.setCpuNumber(String.valueOf(offering.getCpu()));
  resultObject.setCpuSpeed(String.valueOf(offering.getSpeed()));
  resultObject.setMemory(String.valueOf(offering.getRamSize()));
  return resultObject;
}