Program: 64045
Project: 64045
Buggy source:
@Override public StackDescription describeStackWithResources(User user,Stack stack,Credential credential){
  String filePath=AzureCertificateService.getUserJksFileName(credential,user.emailAsFolder());
  AzureClient azureClient=azureStackUtil.createAzureClient(credential,filePath);
  DetailedAzureStackDescription detailedAzureStackDescription=new DetailedAzureStackDescription();
  try {
    Object affinityGroup=azureClient.getAffinityGroup(stack.getResourcesbyType(ResourceType.AFFINITY_GROUP).get(0).getResourceName());
    detailedAzureStackDescription.setAffinityGroup(jsonHelper.createJsonFromString(affinityGroup.toString()));
  }
 catch (  Exception ex) {
    detailedAzureStackDescription.setAffinityGroup(jsonHelper.createJsonFromString(String.format("String_Node_Str",ERROR)));
  }
  try {
    Object storageAccount=azureClient.getStorageAccount(stack.getResourcesbyType(ResourceType.STORAGE).get(0).getResourceName());
    detailedAzureStackDescription.setStorageAccount(jsonHelper.createJsonFromString(storageAccount.toString()));
  }
 catch (  Exception ex) {
    detailedAzureStackDescription.setStorageAccount(jsonHelper.createJsonFromString(String.format("String_Node_Str",ERROR)));
  }
  for (  Resource resource : stack.getResourcesbyType(ResourceType.VIRTUAL_MACHINE)) {
    try {
      Object cloudService=azureClient.getCloudService(resource.getResourceName());
      detailedAzureStackDescription.getCloudServices().add(jsonHelper.createJsonFromString(cloudService.toString()).toString());
    }
 catch (    Exception ex) {
      detailedAzureStackDescription.getCloudServices().add(jsonHelper.createJsonFromString(String.format("String_Node_Str",ERROR)).toString());
    }
  }
  for (  Resource resource : stack.getResourcesbyType(ResourceType.CLOUD_SERVICE)) {
    Map<String,String> props=new HashMap<>();
    props.put(SERVICENAME,resource.getResourceName());
    props.put(NAME,resource.getResourceName());
    try {
      Object virtualMachine=azureClient.getVirtualMachine(props);
      detailedAzureStackDescription.getVirtualMachines().add(jsonHelper.createJsonFromString(virtualMachine.toString()).toString());
    }
 catch (    Exception ex) {
      detailedAzureStackDescription.getVirtualMachines().add(jsonHelper.createJsonFromString(String.format("String_Node_Str",ERROR)).toString());
    }
  }
  return detailedAzureStackDescription;
}

Fixed version (ground truth):
@Override public StackDescription describeStackWithResources(User user,Stack stack,Credential credential){
  String filePath=AzureCertificateService.getUserJksFileName(credential,user.emailAsFolder());
  AzureClient azureClient=azureStackUtil.createAzureClient(credential,filePath);
  DetailedAzureStackDescription detailedAzureStackDescription=new DetailedAzureStackDescription();
  try {
    Object affinityGroup=azureClient.getAffinityGroup(stack.getResourcesByType(ResourceType.AFFINITY_GROUP).get(0).getResourceName());
    detailedAzureStackDescription.setAffinityGroup(jsonHelper.createJsonFromString(affinityGroup.toString()));
  }
 catch (  Exception ex) {
    detailedAzureStackDescription.setAffinityGroup(jsonHelper.createJsonFromString(String.format("String_Node_Str",ERROR)));
  }
  try {
    Object storageAccount=azureClient.getStorageAccount(stack.getResourcesByType(ResourceType.STORAGE).get(0).getResourceName());
    detailedAzureStackDescription.setStorageAccount(jsonHelper.createJsonFromString(storageAccount.toString()));
  }
 catch (  Exception ex) {
    detailedAzureStackDescription.setStorageAccount(jsonHelper.createJsonFromString(String.format("String_Node_Str",ERROR)));
  }
  for (  Resource resource : stack.getResourcesByType(ResourceType.VIRTUAL_MACHINE)) {
    try {
      Object cloudService=azureClient.getCloudService(resource.getResourceName());
      detailedAzureStackDescription.getCloudServices().add(jsonHelper.createJsonFromString(cloudService.toString()).toString());
    }
 catch (    Exception ex) {
      detailedAzureStackDescription.getCloudServices().add(jsonHelper.createJsonFromString(String.format("String_Node_Str",ERROR)).toString());
    }
  }
  for (  Resource resource : stack.getResourcesByType(ResourceType.CLOUD_SERVICE)) {
    Map<String,String> props=new HashMap<>();
    props.put(SERVICENAME,resource.getResourceName());
    props.put(NAME,resource.getResourceName());
    try {
      Object virtualMachine=azureClient.getVirtualMachine(props);
      detailedAzureStackDescription.getVirtualMachines().add(jsonHelper.createJsonFromString(virtualMachine.toString()).toString());
    }
 catch (    Exception ex) {
      detailedAzureStackDescription.getVirtualMachines().add(jsonHelper.createJsonFromString(String.format("String_Node_Str",ERROR)).toString());
    }
  }
  return detailedAzureStackDescription;
}