Program: 64072
Project: 64072
Buggy source:
private void createVirtualMachine(AzureClient azureClient,AzureTemplate azureTemplate,String name,String vmName,String commonName,String emailAsFolder,String userData) throws FileNotFoundException, CertificateException, NoSuchAlgorithmException {
  byte[] encoded=Base64.encodeBase64(vmName.getBytes());
  String label=new String(encoded);
  Map<String,Object> props=new HashMap<>();
  List<Port> ports=new ArrayList<>();
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  props.put(NAME,vmName);
  props.put(DEPLOYMENTSLOT,PRODUCTION);
  props.put(LABEL,label);
  props.put(IMAGENAME,azureTemplate.getImageName());
  props.put(IMAGESTOREURI,String.format("String_Node_Str",commonName,vmName));
  props.put(HOSTNAME,vmName);
  props.put(USERNAME,DEFAULT_USER_NAME);
  if (azureTemplate.getPassword() != null && !azureTemplate.getPassword().isEmpty()) {
    props.put(PASSWORD,azureTemplate.getPassword());
  }
 else {
    X509Certificate sshCert=new X509Certificate(AzureCertificateService.getCerFile(emailAsFolder,azureTemplate.getId()));
    props.put(SSHPUBLICKEYFINGERPRINT,sshCert.getSha1Fingerprint().toUpperCase());
    props.put(SSHPUBLICKEYPATH,String.format("String_Node_Str",DEFAULT_USER_NAME));
  }
  props.put(SERVICENAME,vmName);
  props.put(SUBNETNAME,name);
  props.put(CUSTOMDATA,new String(Base64.encodeBase64(userData.getBytes())));
  props.put(VIRTUALNETWORKNAME,name);
  props.put(PORTS,ports);
  props.put(VMTYPE,AzureVmType.valueOf(azureTemplate.getVmType()).vmType().replaceAll("String_Node_Str","String_Node_Str"));
  HttpResponseDecorator virtualMachineResponse=(HttpResponseDecorator)azureClient.createVirtualMachine(props);
  String requestId=(String)azureClient.getRequestId(virtualMachineResponse);
  azureClient.waitUntilComplete(requestId);
}

Fixed version (ground truth):
private void createVirtualMachine(AzureClient azureClient,AzureTemplate azureTemplate,Credential credential,String name,String vmName,String commonName,String userData) throws FileNotFoundException, CertificateException, NoSuchAlgorithmException {
  byte[] encoded=Base64.encodeBase64(vmName.getBytes());
  String label=new String(encoded);
  Map<String,Object> props=new HashMap<>();
  List<Port> ports=new ArrayList<>();
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  ports.add(new Port("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  props.put(NAME,vmName);
  props.put(DEPLOYMENTSLOT,PRODUCTION);
  props.put(LABEL,label);
  props.put(IMAGENAME,azureTemplate.getImageName().equals(AzureStackUtil.IMAGE_NAME) ? AzureStackUtil.getOsImageName(credential) : azureTemplate.getImageName());
  props.put(IMAGESTOREURI,String.format("String_Node_Str",commonName,vmName));
  props.put(HOSTNAME,vmName);
  props.put(USERNAME,DEFAULT_USER_NAME);
  if (azureTemplate.getPassword() != null && !azureTemplate.getPassword().isEmpty()) {
    props.put(PASSWORD,azureTemplate.getPassword());
  }
 else {
    X509Certificate sshCert=new X509Certificate(AzureCertificateService.getCerFile(azureTemplate.getOwner().emailAsFolder(),azureTemplate.getId()));
    props.put(SSHPUBLICKEYFINGERPRINT,sshCert.getSha1Fingerprint().toUpperCase());
    props.put(SSHPUBLICKEYPATH,String.format("String_Node_Str",DEFAULT_USER_NAME));
  }
  props.put(SERVICENAME,vmName);
  props.put(SUBNETNAME,name);
  props.put(CUSTOMDATA,new String(Base64.encodeBase64(userData.getBytes())));
  props.put(VIRTUALNETWORKNAME,name);
  props.put(PORTS,ports);
  props.put(VMTYPE,AzureVmType.valueOf(azureTemplate.getVmType()).vmType().replaceAll("String_Node_Str","String_Node_Str"));
  HttpResponseDecorator virtualMachineResponse=(HttpResponseDecorator)azureClient.createVirtualMachine(props);
  String requestId=(String)azureClient.getRequestId(virtualMachineResponse);
  azureClient.waitUntilComplete(requestId);
}