Program: 64044
Project: 64044
Buggy source:
@Override public void deleteStack(User user,Stack stack,Credential credential){
  String filePath=AzureCertificateService.getUserJksFileName(credential,user.emailAsFolder());
  AzureClient azureClient=azureStackUtil.createAzureClient(credential,filePath);
  for (  Resource resource : stack.getResourcesbyType(ResourceType.VIRTUAL_MACHINE)) {
    Map<String,String> props;
    try {
      props=new HashMap<>();
      props.put(SERVICENAME,resource.getResourceName());
      props.put(NAME,resource.getResourceName());
      HttpResponseDecorator deleteVirtualMachineResult=(HttpResponseDecorator)azureClient.deleteVirtualMachine(props);
      String requestId=(String)azureClient.getRequestId(deleteVirtualMachineResult);
      azureClient.waitUntilComplete(requestId);
    }
 catch (    HttpResponseException ex) {
      httpResponseExceptionHandler(ex,resource.getResourceName(),user.getId());
    }
catch (    Exception ex) {
      throw new InternalServerException(ex.getMessage());
    }
  }
  for (  Resource resource : stack.getResourcesbyType(ResourceType.CLOUD_SERVICE)) {
    Map<String,String> props;
    try {
      props=new HashMap<>();
      props.put(SERVICENAME,((AzureCredential)credential).getName().replaceAll("String_Node_Str","String_Node_Str"));
      props.put(NAME,resource.getResourceName());
      HttpResponseDecorator deleteCloudServiceResult=(HttpResponseDecorator)azureClient.deleteCloudService(props);
      String requestId=(String)azureClient.getRequestId(deleteCloudServiceResult);
      azureClient.waitUntilComplete(requestId);
    }
 catch (    HttpResponseException ex) {
      httpResponseExceptionHandler(ex,resource.getResourceName(),user.getId());
    }
catch (    Exception ex) {
      throw new InternalServerException(ex.getMessage());
    }
  }
  for (  Resource resource : stack.getResourcesbyType(ResourceType.NETWORK)) {
    Map<String,String> props;
    try {
      props=new HashMap<>();
      props.put(NAME,resource.getResourceName());
      HttpResponseDecorator deleteVirtualNetworkResult=(HttpResponseDecorator)azureClient.deleteVirtualNetwork(props);
      String requestId=(String)azureClient.getRequestId(deleteVirtualNetworkResult);
      azureClient.waitUntilComplete(requestId);
    }
 catch (    HttpResponseException ex) {
      httpResponseExceptionHandler(ex,resource.getResourceName(),user.getId());
    }
catch (    Exception ex) {
      throw new InternalServerException(ex.getMessage());
    }
  }
}

Fixed version (ground truth):
@Override public void deleteStack(User user,Stack stack,Credential credential){
  String filePath=AzureCertificateService.getUserJksFileName(credential,user.emailAsFolder());
  AzureClient azureClient=azureStackUtil.createAzureClient(credential,filePath);
  for (  Resource resource : stack.getResourcesByType(ResourceType.VIRTUAL_MACHINE)) {
    Map<String,String> props;
    try {
      props=new HashMap<>();
      props.put(SERVICENAME,resource.getResourceName());
      props.put(NAME,resource.getResourceName());
      HttpResponseDecorator deleteVirtualMachineResult=(HttpResponseDecorator)azureClient.deleteVirtualMachine(props);
      String requestId=(String)azureClient.getRequestId(deleteVirtualMachineResult);
      azureClient.waitUntilComplete(requestId);
    }
 catch (    HttpResponseException ex) {
      httpResponseExceptionHandler(ex,resource.getResourceName(),user.getId());
    }
catch (    Exception ex) {
      throw new InternalServerException(ex.getMessage());
    }
  }
  for (  Resource resource : stack.getResourcesByType(ResourceType.CLOUD_SERVICE)) {
    Map<String,String> props;
    try {
      props=new HashMap<>();
      props.put(SERVICENAME,((AzureCredential)credential).getName().replaceAll("String_Node_Str","String_Node_Str"));
      props.put(NAME,resource.getResourceName());
      HttpResponseDecorator deleteCloudServiceResult=(HttpResponseDecorator)azureClient.deleteCloudService(props);
      String requestId=(String)azureClient.getRequestId(deleteCloudServiceResult);
      azureClient.waitUntilComplete(requestId);
    }
 catch (    HttpResponseException ex) {
      httpResponseExceptionHandler(ex,resource.getResourceName(),user.getId());
    }
catch (    Exception ex) {
      throw new InternalServerException(ex.getMessage());
    }
  }
  for (  Resource resource : stack.getResourcesByType(ResourceType.NETWORK)) {
    Map<String,String> props;
    try {
      props=new HashMap<>();
      props.put(NAME,resource.getResourceName());
      HttpResponseDecorator deleteVirtualNetworkResult=(HttpResponseDecorator)azureClient.deleteVirtualNetwork(props);
      String requestId=(String)azureClient.getRequestId(deleteVirtualNetworkResult);
      azureClient.waitUntilComplete(requestId);
    }
 catch (    HttpResponseException ex) {
      httpResponseExceptionHandler(ex,resource.getResourceName(),user.getId());
    }
catch (    Exception ex) {
      throw new InternalServerException(ex.getMessage());
    }
  }
}