Program: 106674
Project: 106674
Buggy source:
@Override public ClusterResponse createClusterResponse(Cluster cluster,Boolean showCapacities){
  ClusterResponse clusterResponse=new ClusterResponse();
  clusterResponse.setId(cluster.getId());
  clusterResponse.setName(cluster.getName());
  clusterResponse.setPodId(cluster.getPodId());
  clusterResponse.setZoneId(cluster.getDataCenterId());
  clusterResponse.setHypervisorType(cluster.getHypervisorType().toString());
  clusterResponse.setClusterType(cluster.getClusterType().toString());
  clusterResponse.setAllocationState(cluster.getAllocationState().toString());
  clusterResponse.setManagedState(cluster.getManagedState().toString());
  HostPodVO pod=ApiDBUtils.findPodById(cluster.getPodId());
  if (pod != null) {
    clusterResponse.setPodName(pod.getName());
  }
  DataCenterVO zone=ApiDBUtils.findZoneById(cluster.getDataCenterId());
  clusterResponse.setZoneName(zone.getName());
  if (showCapacities != null && showCapacities) {
    List<SummedCapacity> capacities=ApiDBUtils.getCapacityByClusterPodZone(null,null,cluster.getId());
    Set<CapacityResponse> capacityResponses=new HashSet<CapacityResponse>();
    float cpuOverprovisioningFactor=ApiDBUtils.getCpuOverprovisioningFactor();
    for (    SummedCapacity capacity : capacities) {
      CapacityResponse capacityResponse=new CapacityResponse();
      capacityResponse.setCapacityType(capacity.getCapacityType());
      capacityResponse.setCapacityUsed(capacity.getUsedCapacity());
      if (capacity.getCapacityType() == Capacity.CAPACITY_TYPE_CPU) {
        capacityResponse.setCapacityTotal(new Long((long)(capacity.getTotalCapacity() * cpuOverprovisioningFactor)));
      }
 else       if (capacity.getCapacityType() == Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED) {
        List<SummedCapacity> c=ApiDBUtils.findNonSharedStorageForClusterPodZone(null,null,cluster.getId());
        capacityResponse.setCapacityTotal(capacity.getTotalCapacity() - c.get(0).getTotalCapacity());
        capacityResponse.setCapacityUsed(capacity.getUsedCapacity() - c.get(0).getUsedCapacity());
      }
 else {
        capacityResponse.setCapacityTotal(capacity.getTotalCapacity());
      }
      if (capacityResponse.getCapacityTotal() != 0) {
        capacityResponse.setPercentUsed(s_percentFormat.format((float)capacityResponse.getCapacityUsed() / (float)capacityResponse.getCapacityTotal() * 100f));
      }
 else {
        capacityResponse.setPercentUsed(s_percentFormat.format(0L));
      }
      capacityResponses.add(capacityResponse);
    }
    capacityResponses.addAll(getStatsCapacityresponse(null,null,pod.getId(),pod.getDataCenterId()));
    clusterResponse.setCapacitites(new ArrayList<CapacityResponse>(capacityResponses));
  }
  clusterResponse.setObjectName("String_Node_Str");
  return clusterResponse;
}

Fixed version (ground truth):
@Override public ClusterResponse createClusterResponse(Cluster cluster,Boolean showCapacities){
  ClusterResponse clusterResponse=new ClusterResponse();
  clusterResponse.setId(cluster.getId());
  clusterResponse.setName(cluster.getName());
  clusterResponse.setPodId(cluster.getPodId());
  clusterResponse.setZoneId(cluster.getDataCenterId());
  clusterResponse.setHypervisorType(cluster.getHypervisorType().toString());
  clusterResponse.setClusterType(cluster.getClusterType().toString());
  clusterResponse.setAllocationState(cluster.getAllocationState().toString());
  clusterResponse.setManagedState(cluster.getManagedState().toString());
  HostPodVO pod=ApiDBUtils.findPodById(cluster.getPodId());
  if (pod != null) {
    clusterResponse.setPodName(pod.getName());
  }
  DataCenterVO zone=ApiDBUtils.findZoneById(cluster.getDataCenterId());
  clusterResponse.setZoneName(zone.getName());
  if (showCapacities != null && showCapacities) {
    List<SummedCapacity> capacities=ApiDBUtils.getCapacityByClusterPodZone(null,null,cluster.getId());
    Set<CapacityResponse> capacityResponses=new HashSet<CapacityResponse>();
    float cpuOverprovisioningFactor=ApiDBUtils.getCpuOverprovisioningFactor();
    for (    SummedCapacity capacity : capacities) {
      CapacityResponse capacityResponse=new CapacityResponse();
      capacityResponse.setCapacityType(capacity.getCapacityType());
      capacityResponse.setCapacityUsed(capacity.getUsedCapacity());
      if (capacity.getCapacityType() == Capacity.CAPACITY_TYPE_CPU) {
        capacityResponse.setCapacityTotal(new Long((long)(capacity.getTotalCapacity() * cpuOverprovisioningFactor)));
      }
 else       if (capacity.getCapacityType() == Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED) {
        List<SummedCapacity> c=ApiDBUtils.findNonSharedStorageForClusterPodZone(null,null,cluster.getId());
        capacityResponse.setCapacityTotal(capacity.getTotalCapacity() - c.get(0).getTotalCapacity());
        capacityResponse.setCapacityUsed(capacity.getUsedCapacity() - c.get(0).getUsedCapacity());
      }
 else {
        capacityResponse.setCapacityTotal(capacity.getTotalCapacity());
      }
      if (capacityResponse.getCapacityTotal() != 0) {
        capacityResponse.setPercentUsed(s_percentFormat.format((float)capacityResponse.getCapacityUsed() / (float)capacityResponse.getCapacityTotal() * 100f));
      }
 else {
        capacityResponse.setPercentUsed(s_percentFormat.format(0L));
      }
      capacityResponses.add(capacityResponse);
    }
    capacityResponses.addAll(getStatsCapacityresponse(null,cluster.getId(),pod.getId(),pod.getDataCenterId()));
    clusterResponse.setCapacitites(new ArrayList<CapacityResponse>(capacityResponses));
  }
  clusterResponse.setObjectName("String_Node_Str");
  return clusterResponse;
}