Program: 64074
Project: 64074
Buggy source:
@Override public void setupProvisioning(Stack stack){
  LOGGER.info("String_Node_Str",ReactorConfig.PROVISION_SETUP_COMPLETE_EVENT,stack.getId());
  Credential credential=stack.getCredential();
  String emailAsFolder=stack.getUser().emailAsFolder();
  String filePath=AzureCertificateService.getUserJksFileName(credential,emailAsFolder);
  File file=new File(filePath);
  AzureClient azureClient=new AzureClient(((AzureCredential)credential).getSubscriptionId(),file.getAbsolutePath(),((AzureCredential)credential).getJks());
  if (!azureClient.isImageAvailable(AzureStackUtil.getOsImageName(credential))) {
    String baseImageUri="String_Node_Str";
    String affinityGroupName=((AzureCredential)credential).getName().replaceAll("String_Node_Str","String_Node_Str");
    try {
      Map<String,String> params=new HashMap<>();
      params.put(AzureStackUtil.NAME,affinityGroupName);
      params.put(DESCRIPTION,VM_COMMON_NAME);
      params.put(LOCATION,"String_Node_Str");
      azureClient.createAffinityGroup(params);
    }
 catch (    Exception ex) {
      LOGGER.info("String_Node_Str");
    }
    String storageName=String.format("String_Node_Str",VM_COMMON_NAME,stack.getId());
    try {
      Map<String,String> params=new HashMap<>();
      params.put(AzureStackUtil.NAME,affinityGroupName);
      params.put(DESCRIPTION,VM_COMMON_NAME);
      params.put(AFFINITYGROUP,affinityGroupName);
      HttpResponseDecorator response=(HttpResponseDecorator)azureClient.createStorageAccount(params);
      azureClient.waitUntilComplete((String)azureClient.getRequestId(response));
    }
 catch (    Exception ex) {
      LOGGER.info("String_Node_Str");
    }
    try {
      String targetBlobContainerUri="String_Node_Str" + affinityGroupName + "String_Node_Str";
      String targetImageUri=targetBlobContainerUri + '/' + storageName+ "String_Node_Str";
      Map<String,String> params=new HashMap<>();
      params.put(AzureStackUtil.NAME,affinityGroupName);
      String keyJson=(String)azureClient.getStorageAccountKeys(params);
      JsonNode actualObj=MAPPER.readValue(keyJson,JsonNode.class);
      String storageAccountKey=actualObj.get("String_Node_Str").get("String_Node_Str").get("String_Node_Str").asText();
      AzureClientUtil.createBlobContainer(storageAccountKey,targetBlobContainerUri);
      AzureClientUtil.copyOsImage(storageAccountKey,baseImageUri,targetImageUri);
      AzureClientUtil.imageCopyProgress(storageAccountKey,targetImageUri);
      params=new HashMap<>();
      params.put(AzureStackUtil.NAME,AzureStackUtil.getOsImageName(credential));
      params.put(OS,"String_Node_Str");
      params.put(MEDIALINK,targetImageUri);
      azureClient.addOsImage(params);
    }
 catch (    IOException e) {
      throw new InternalServerException("String_Node_Str");
    }
  }
  reactor.notify(ReactorConfig.PROVISION_SETUP_COMPLETE_EVENT,Event.wrap(new ProvisionSetupComplete(getCloudPlatform(),stack.getId()).withSetupProperty(CREDENTIAL,stack.getCredential()).withSetupProperty(EMAILASFOLDER,stack.getUser().emailAsFolder())));
}

Fixed version (ground truth):
@Override public void setupProvisioning(Stack stack){
  LOGGER.info("String_Node_Str",ReactorConfig.PROVISION_SETUP_COMPLETE_EVENT,stack.getId());
  Credential credential=stack.getCredential();
  String emailAsFolder=stack.getUser().emailAsFolder();
  String filePath=AzureCertificateService.getUserJksFileName(credential,emailAsFolder);
  File file=new File(filePath);
  AzureClient azureClient=new AzureClient(((AzureCredential)credential).getSubscriptionId(),file.getAbsolutePath(),((AzureCredential)credential).getJks());
  if (!azureClient.isImageAvailable(AzureStackUtil.getOsImageName(credential))) {
    String affinityGroupName=((AzureCredential)credential).getName().replaceAll("String_Node_Str","String_Node_Str");
    try {
      azureClient.getAffinityGroup(affinityGroupName);
    }
 catch (    Exception ex) {
      if (((HttpResponseException)ex).getStatusCode() == NOT_FOUND) {
        Map<String,String> params=new HashMap<>();
        params.put(AzureStackUtil.NAME,affinityGroupName);
        params.put(DESCRIPTION,VM_COMMON_NAME);
        params.put(LOCATION,"String_Node_Str");
        azureClient.createAffinityGroup(params);
      }
 else {
        LOGGER.info("String_Node_Str");
        reactor.notify(ReactorConfig.STACK_CREATE_FAILED_EVENT,Event.wrap(new ClusterCreationFailure(stack.getId(),"String_Node_Str")));
      }
    }
    String storageName=String.format("String_Node_Str",VM_COMMON_NAME,stack.getId());
    try {
      azureClient.getStorageAccount(affinityGroupName);
    }
 catch (    Exception ex) {
      if (((HttpResponseException)ex).getStatusCode() == NOT_FOUND) {
        Map<String,String> params=new HashMap<>();
        params.put(AzureStackUtil.NAME,affinityGroupName);
        params.put(DESCRIPTION,VM_COMMON_NAME);
        params.put(AFFINITYGROUP,affinityGroupName);
        HttpResponseDecorator response=(HttpResponseDecorator)azureClient.createStorageAccount(params);
        azureClient.waitUntilComplete((String)azureClient.getRequestId(response));
      }
 else {
        LOGGER.info("String_Node_Str");
        reactor.notify(ReactorConfig.STACK_CREATE_FAILED_EVENT,Event.wrap(new ClusterCreationFailure(stack.getId(),"String_Node_Str")));
      }
    }
    try {
      String targetBlobContainerUri="String_Node_Str" + affinityGroupName + "String_Node_Str";
      String targetImageUri=targetBlobContainerUri + '/' + storageName+ "String_Node_Str";
      Map<String,String> params=new HashMap<>();
      params.put(AzureStackUtil.NAME,affinityGroupName);
      String keyJson=(String)azureClient.getStorageAccountKeys(params);
      JsonNode actualObj=MAPPER.readValue(keyJson,JsonNode.class);
      String storageAccountKey=actualObj.get("String_Node_Str").get("String_Node_Str").get("String_Node_Str").asText();
      AzureClientUtil.createBlobContainer(storageAccountKey,targetBlobContainerUri);
      AzureClientUtil.copyOsImage(storageAccountKey,baseImageUri,targetImageUri);
      AzureClientUtil.imageCopyProgress(storageAccountKey,targetImageUri);
      params=new HashMap<>();
      params.put(AzureStackUtil.NAME,AzureStackUtil.getOsImageName(credential));
      params.put(OS,"String_Node_Str");
      params.put(MEDIALINK,targetImageUri);
      azureClient.addOsImage(params);
    }
 catch (    IOException e) {
      reactor.notify(ReactorConfig.STACK_CREATE_FAILED_EVENT,Event.wrap(new ClusterCreationFailure(stack.getId(),"String_Node_Str")));
    }
  }
  reactor.notify(ReactorConfig.PROVISION_SETUP_COMPLETE_EVENT,Event.wrap(new ProvisionSetupComplete(getCloudPlatform(),stack.getId()).withSetupProperty(CREDENTIAL,stack.getCredential()).withSetupProperty(EMAILASFOLDER,stack.getUser().emailAsFolder())));
}