nus-yam/ex-repair huggingface dataset:
Program: 63956
Project: 63956
Buggy source:
private Certificate getCertificate(AzureCredential azureCredential,String serviceFilesPathWithoutExtension) throws Exception {
  keyGeneratorService.generateKey("String_Node_Str",azureCredential,"String_Node_Str",serviceFilesPathWithoutExtension + "String_Node_Str");
  KeyStore ks=KeyStore.getInstance(KeyStore.getDefaultType());
  char[] pass=azureCredential.getJks().toCharArray();
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(new File(serviceFilesPathWithoutExtension + "String_Node_Str"));
    ks.load(fis,pass);
  }
  finally {
    if (fis != null) {
      fis.close();
    }
  }
  return ks.getCertificate("String_Node_Str");
}

Fixed version (ground truth):
private Certificate getCertificate(AzureCredential azureCredential,String serviceFilesPathWithoutExtension) throws Exception {
  String email=userDetailsService.getDetails(azureCredential.getOwner(),UserFilterField.USERID).getUsername();
  keyGeneratorService.generateKey(email,azureCredential,"String_Node_Str",serviceFilesPathWithoutExtension + "String_Node_Str");
  KeyStore ks=KeyStore.getInstance(KeyStore.getDefaultType());
  char[] pass=azureCredential.getJks().toCharArray();
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(new File(serviceFilesPathWithoutExtension + "String_Node_Str"));
    ks.load(fis,pass);
  }
  finally {
    if (fis != null) {
      fis.close();
    }
  }
  return ks.getCertificate("String_Node_Str");
}
Program: 63957
Project: 63957
Buggy source:
public void generateKey(String user,AzureCredential azureCredential,String alias,String path) throws Exception {
  String command=StringUtils.join(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",alias,"String_Node_Str","String_Node_Str","String_Node_Str",path,"String_Node_Str","String_Node_Str","String_Node_Str",AzureStackUtil.DEFAULT_JKS_PASS,"String_Node_Str",AzureStackUtil.DEFAULT_JKS_PASS,"String_Node_Str","String_Node_Str" + user + azureCredential.getPostFix()+ "String_Node_Str"},"String_Node_Str");
  Process p=Runtime.getRuntime().exec(command);
  p.waitFor();
}

Fixed version (ground truth):
public void generateKey(String user,AzureCredential azureCredential,String alias,String path) throws Exception {
  String command=StringUtils.join(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str",alias,"String_Node_Str","String_Node_Str","String_Node_Str",path,"String_Node_Str","String_Node_Str","String_Node_Str",AzureStackUtil.DEFAULT_JKS_PASS,"String_Node_Str",AzureStackUtil.DEFAULT_JKS_PASS,"String_Node_Str","String_Node_Str" + user + "String_Node_Str"},"String_Node_Str");
  Process p=Runtime.getRuntime().exec(command);
  p.waitFor();
}
Program: 63958
Project: 63958
Buggy source:
@Override public boolean checkStatus(AzureResourcePollerObject t){
  List<HttpResponseDecorator> responses=t.getResponses();
  boolean result=true;
  Iterator<HttpResponseDecorator> iterator=responses.iterator();
  while (iterator.hasNext()) {
    HttpResponseDecorator response=iterator.next();
    String requestId=getRequestId(response);
    String requestStatus=String.valueOf(t.getAzureClient().getRequestStatus(requestId));
    JsonNode jsonFromString=jsonHelper.createJsonFromString(requestStatus);
    String status=jsonFromString.get("String_Node_Str").get("String_Node_Str").asText();
    if ("String_Node_Str".equals(status)) {
      result=false;
      break;
    }
 else     if ("String_Node_Str".equals(status)) {
      throw new AzureResourceException(jsonFromString.get("String_Node_Str").get("String_Node_Str").get("String_Node_Str").asText());
    }
 else {
      iterator.remove();
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean checkStatus(AzureResourcePollerObject t){
  List<HttpResponseDecorator> responses=t.getResponses();
  boolean result=true;
  Iterator<HttpResponseDecorator> iterator=responses.iterator();
  while (iterator.hasNext()) {
    HttpResponseDecorator response=iterator.next();
    String requestId=getRequestId(response);
    String requestStatus=String.valueOf(t.getAzureClient().getRequestStatus(requestId));
    JsonNode jsonFromString=jsonHelper.createJsonFromString(requestStatus);
    String status=jsonFromString.get("String_Node_Str").get("String_Node_Str").asText();
    if ("String_Node_Str".equals(status)) {
      result=false;
      break;
    }
 else     if ("String_Node_Str".equals(status)) {
      String error=jsonFromString.get("String_Node_Str").get("String_Node_Str").get("String_Node_Str").asText();
      throw new AzureResourceException(error);
    }
 else {
      iterator.remove();
    }
  }
  return result;
}
Program: 63959
Project: 63959
Buggy source:
@Override public Boolean create(final CreateResourceRequest createResourceRequest,String region) throws Exception {
  AzureCloudServiceCreateRequest aCSCR=(AzureCloudServiceCreateRequest)createResourceRequest;
  HttpResponseDecorator cloudServiceResponse=(HttpResponseDecorator)aCSCR.getAzureClient().createCloudService(aCSCR.getProps());
  AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(aCSCR.getAzureClient(),aCSCR.getStack(),cloudServiceResponse);
  azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
  return true;
}

Fixed version (ground truth):
@Override public Boolean create(final CreateResourceRequest createResourceRequest,String region) throws Exception {
  AzureCloudServiceCreateRequest aCSCR=(AzureCloudServiceCreateRequest)createResourceRequest;
  try {
    HttpResponseDecorator cloudServiceResponse=(HttpResponseDecorator)aCSCR.getAzureClient().createCloudService(aCSCR.getProps());
    AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(aCSCR.getAzureClient(),aCSCR.getStack(),cloudServiceResponse);
    azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
  }
 catch (  Exception ex) {
    throw checkException(ex);
  }
  return true;
}
Program: 63960
Project: 63960
Buggy source:
@Override public Boolean create(final CreateResourceRequest createResourceRequest,final String region) throws Exception {
  AzureServiceCertificateCreateRequest aCSCR=(AzureServiceCertificateCreateRequest)createResourceRequest;
  HttpResponseDecorator serviceCertificate=(HttpResponseDecorator)aCSCR.getAzureClient().createServiceCertificate(aCSCR.getProps());
  AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(aCSCR.getAzureClient(),aCSCR.getStack(),serviceCertificate);
  azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
  return true;
}

Fixed version (ground truth):
@Override public Boolean create(final CreateResourceRequest createResourceRequest,final String region) throws Exception {
  AzureServiceCertificateCreateRequest aCSCR=(AzureServiceCertificateCreateRequest)createResourceRequest;
  try {
    HttpResponseDecorator serviceCertificate=(HttpResponseDecorator)aCSCR.getAzureClient().createServiceCertificate(aCSCR.getProps());
    AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(aCSCR.getAzureClient(),aCSCR.getStack(),serviceCertificate);
    azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
  }
 catch (  Exception ex) {
    throw checkException(ex);
  }
  return true;
}
Program: 63961
Project: 63961
Buggy source:
@Override public Boolean create(final CreateResourceRequest createResourceRequest,final String region) throws Exception {
  AzureVirtualMachineCreateRequest aCSCR=(AzureVirtualMachineCreateRequest)createResourceRequest;
  HttpResponseDecorator virtualMachineResponse=(HttpResponseDecorator)aCSCR.getAzureClient().createVirtualMachine(aCSCR.getProps());
  AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(aCSCR.getAzureClient(),aCSCR.getStack(),virtualMachineResponse);
  azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
  return true;
}

Fixed version (ground truth):
@Override public Boolean create(final CreateResourceRequest createResourceRequest,final String region) throws Exception {
  AzureVirtualMachineCreateRequest aCSCR=(AzureVirtualMachineCreateRequest)createResourceRequest;
  try {
    HttpResponseDecorator virtualMachineResponse=(HttpResponseDecorator)aCSCR.getAzureClient().createVirtualMachine(aCSCR.getProps());
    AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(aCSCR.getAzureClient(),aCSCR.getStack(),virtualMachineResponse);
    azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
  }
 catch (  Exception ex) {
    throw checkException(ex);
  }
  return true;
}
Program: 63962
Project: 63962
Buggy source:
@Override public Boolean create(CreateResourceRequest createResourceRequest,String region) throws Exception {
  AzureNetworkCreateRequest request=(AzureNetworkCreateRequest)createResourceRequest;
  Stack stack=stackRepository.findById(request.getStackId());
  if (!request.getAzureClient().getVirtualNetworkConfiguration().toString().contains(request.getName())) {
    HttpResponseDecorator virtualNetworkResponse=(HttpResponseDecorator)request.getAzureClient().createVirtualNetwork(request.getProps());
    AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(request.getAzureClient(),stack,virtualNetworkResponse);
    azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
  }
  return true;
}

Fixed version (ground truth):
@Override public Boolean create(CreateResourceRequest createResourceRequest,String region) throws Exception {
  AzureNetworkCreateRequest request=(AzureNetworkCreateRequest)createResourceRequest;
  try {
    Stack stack=stackRepository.findById(request.getStackId());
    if (!request.getAzureClient().getVirtualNetworkConfiguration().toString().contains(request.getName())) {
      HttpResponseDecorator virtualNetworkResponse=(HttpResponseDecorator)request.getAzureClient().createVirtualNetwork(request.getProps());
      AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(request.getAzureClient(),stack,virtualNetworkResponse);
      azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
    }
  }
 catch (  Exception ex) {
    throw checkException(ex);
  }
  return true;
}
Program: 63963
Project: 63963
Buggy source:
@Override public Boolean create(CreateResourceRequest createResourceRequest,String region) throws Exception {
  AzureReservedIpCreateRequest azureReservedIpCreateRequest=(AzureReservedIpCreateRequest)createResourceRequest;
  HttpResponseDecorator serviceCertificate=(HttpResponseDecorator)azureReservedIpCreateRequest.getAzureClient().createReservedIP(azureReservedIpCreateRequest.getProps());
  AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(azureReservedIpCreateRequest.getAzureClient(),azureReservedIpCreateRequest.getStack(),serviceCertificate);
  azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
  return true;
}

Fixed version (ground truth):
@Override public Boolean create(CreateResourceRequest createResourceRequest,String region) throws Exception {
  AzureReservedIpCreateRequest azureReservedIpCreateRequest=(AzureReservedIpCreateRequest)createResourceRequest;
  try {
    HttpResponseDecorator serviceCertificate=(HttpResponseDecorator)azureReservedIpCreateRequest.getAzureClient().createReservedIP(azureReservedIpCreateRequest.getProps());
    AzureResourcePollerObject azureResourcePollerObject=new AzureResourcePollerObject(azureReservedIpCreateRequest.getAzureClient(),azureReservedIpCreateRequest.getStack(),serviceCertificate);
    azureResourcePollerObjectPollingService.pollWithTimeout(azureCreateResourceStatusCheckerTask,azureResourcePollerObject,POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
  }
 catch (  Exception ex) {
    throw checkException(ex);
  }
  return true;
}
Program: 63964
Project: 63964
Buggy source:
public FlowContext setup(ProvisioningContext provisioningContext) throws CloudbreakException {
  Stack stack=stackRepository.findOneWithLists(provisioningContext.getStackId());
  MDCBuilder.buildMdcContext(stack);
  ContainerOrchestrator containerOrchestrator=containerOrchestrators.get(containerOrchestratorTool);
  ContainerOrchestratorClient client=containerOrchestrator.bootstrap(provisioningContext.getStackId());
  containerOrchestrator.startRegistrator(client,provisioningContext.getStackId());
  containerOrchestrator.startAmbariServer(client,provisioningContext.getStackId());
  containerOrchestrator.startAmbariAgents(client,provisioningContext.getStackId());
  containerOrchestrator.startConsulWatches(client,provisioningContext.getStackId());
  return new ProvisioningContext.Builder().setAmbariIp(provisioningContext.getAmbariIp()).setDefaultParams(stack.getId(),stack.cloudPlatform()).build();
}

Fixed version (ground truth):
public FlowContext setup(ProvisioningContext provisioningContext) throws CloudbreakException {
  Stack stack=stackRepository.findOneWithLists(provisioningContext.getStackId());
  ContainerOrchestrator containerOrchestrator=containerOrchestrators.get(containerOrchestratorTool);
  ContainerOrchestratorClient client=containerOrchestrator.bootstrap(provisioningContext.getStackId());
  containerOrchestrator.startRegistrator(client,provisioningContext.getStackId());
  containerOrchestrator.startAmbariServer(client,provisioningContext.getStackId());
  containerOrchestrator.startAmbariAgents(client,provisioningContext.getStackId());
  containerOrchestrator.startConsulWatches(client,provisioningContext.getStackId());
  return new ProvisioningContext.Builder().setAmbariIp(provisioningContext.getAmbariIp()).setDefaultParams(stack.getId(),stack.cloudPlatform()).build();
}
Program: 63965
Project: 63965
Buggy source:
public static String createContainer(DockerClient client,CreateContainerCmd createContainerCmd) throws Exception {
  int attempts=0;
  Exception cause=null;
  String response=null;
  while (attempts < MAX_RETRIES && response == null) {
    try {
      response=createContainerCmd.exec().getId();
    }
 catch (    ProcessingException e) {
      if (e.getCause() instanceof SocketTimeoutException) {
        LOGGER.info("String_Node_Str");
        InspectContainerResponse inspectResponse=inspectContainer(client.inspectContainerCmd(createContainerCmd.getName()));
        if (inspectResponse != null && inspectResponse.getId() != null) {
          response=inspectResponse.getId();
        }
 else {
          attempts++;
          cause=e;
        }
      }
 else {
        throw e;
      }
    }
  }
  if (response == null) {
    throw cause;
  }
  return response;
}

Fixed version (ground truth):
public static String createContainer(DockerClient client,CreateContainerCmd createContainerCmd) throws Exception {
  int attempts=0;
  Exception cause=null;
  String response=null;
  while (attempts < MAX_RETRIES && response == null) {
    try {
      response=createContainerCmd.exec().getId();
    }
 catch (    ProcessingException e) {
      if (e.getCause() instanceof SocketTimeoutException) {
        LOGGER.info("String_Node_Str");
        InspectContainerResponse inspectResponse=waitForContainer(client.inspectContainerCmd(createContainerCmd.getName()));
        if (inspectResponse != null && inspectResponse.getId() != null) {
          response=inspectResponse.getId();
        }
 else {
          attempts++;
          cause=e;
        }
      }
 else {
        throw e;
      }
    }
  }
  if (response == null) {
    throw cause;
  }
  return response;
}
Program: 63966
Project: 63966
Buggy source:
@Override public boolean checkStatus(SwarmContext swarmContext){
  LOGGER.info("String_Node_Str");
  try {
    List<Object> driverStatus=swarmContext.getDockerClient().infoCmd().exec().getDriverStatuses();
    LOGGER.debug("String_Node_Str");
    for (    Object element : driverStatus) {
      try {
        List objects=(ArrayList)element;
        if (objects.get(0).toString().endsWith("String_Node_Str") && Integer.valueOf(objects.get(1).toString()) == swarmContext.getNodeCount()) {
          return true;
        }
      }
 catch (      Exception e) {
        LOGGER.error(String.format("String_Node_Str",element),e);
      }
    }
  }
 catch (  Exception ex) {
    return false;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkStatus(SwarmContext swarmContext){
  LOGGER.info("String_Node_Str");
  try {
    List<Object> driverStatus=swarmContext.getDockerClient().infoCmd().exec().getDriverStatuses();
    LOGGER.debug("String_Node_Str");
    for (    Object element : driverStatus) {
      try {
        List objects=(ArrayList)element;
        if (objects.get(0).toString().endsWith("String_Node_Str") && Integer.valueOf(objects.get(1).toString()) == swarmContext.getNodeCount()) {
          return true;
        }
      }
 catch (      Exception e) {
        LOGGER.error(String.format("String_Node_Str",element),e);
      }
    }
  }
 catch (  Throwable t) {
    return false;
  }
  return false;
}
Program: 63969
Project: 63969
Buggy source:
public Boolean call() throws Exception {
  HostConfig hostConfig=new HostConfig();
  hostConfig.setPrivileged(true);
  String containerId=DockerClientUtil.createContainer(docker,docker.createContainerCmd(containerName).withName(MUNCHAUSEN.getName() + new Date().getTime()).withHostConfig(hostConfig).withCmd(cmd));
  DockerClientUtil.startContainer(docker,docker.startContainerCmd(containerId).withBinds(new Bind("String_Node_Str",new Volume("String_Node_Str"))));
  return true;
}

Fixed version (ground truth):
public Boolean call() throws Exception {
  HostConfig hostConfig=new HostConfig();
  hostConfig.setPrivileged(true);
  String containerId=DockerClientUtil.createContainer(docker,docker.createContainerCmd(containerName).withName(MUNCHAUSEN.getName() + new Date().getTime()).withHostConfig(hostConfig).withCmd(cmd));
  DockerClientUtil.startContainer(docker,docker.startContainerCmd(containerId).withBinds(new Bind("String_Node_Str",new Volume("String_Node_Str"))));
  LOGGER.info("String_Node_Str");
  return true;
}
Program: 63970
Project: 63970
Buggy source:
public AmbariRoleAllocationComplete allocateRoles(Long stackId){
  AmbariRoleAllocationComplete allocationComplete=null;
  Stack stack=stackRepository.findById(stackId);
  MDCBuilder.buildMdcContext(stack);
  Set<InstanceMetaData> allInstanceMetaData=stack.getAllInstanceMetaData();
  PollingResult pollingResult=waitForConsulAgents(stack,allInstanceMetaData,Collections.<InstanceMetaData>emptySet());
  if (isSuccess(pollingResult)) {
    updateWithConsulData(allInstanceMetaData);
    instanceMetaDataRepository.save(allInstanceMetaData);
    allocationComplete=new AmbariRoleAllocationComplete(stack,stack.getAmbariIp());
  }
  return allocationComplete;
}

Fixed version (ground truth):
public AmbariRoleAllocationComplete allocateRoles(Long stackId){
  AmbariRoleAllocationComplete allocationComplete=null;
  Stack stack=stackRepository.findById(stackId);
  MDCBuilder.buildMdcContext(stack);
  Set<InstanceMetaData> allInstanceMetaData=stack.getAllInstanceMetaData();
  PollingResult pollingResult=waitForConsulAgents(stack,allInstanceMetaData,Collections.<InstanceMetaData>emptySet());
  if (!isSuccess(pollingResult)) {
    throw new WrongMetadataException("String_Node_Str");
  }
  updateWithConsulData(allInstanceMetaData);
  instanceMetaDataRepository.save(allInstanceMetaData);
  return new AmbariRoleAllocationComplete(stack,stack.getAmbariIp());
}
Program: 63971
Project: 63971
Buggy source:
@Test(expected=WrongMetadataException.class) public void testAllocateRolesWhenCannotConnectConsul(){
  stack.getInstanceGroupByInstanceGroupName(INSTANCE_GROUP_1).setInstanceMetaData(createInstanceMetaDataWithAmbariAddress(DUMMY_AMBARI_ADDRESS));
  stack.getInstanceGroupByInstanceGroupName(INSTANCE_GROUP_2).setInstanceMetaData(createInstanceMetaDataWithAmbariAddress(DUMMY_AMBARI_ADDRESS));
  given(stackRepository.findById(1L)).willReturn(stack);
  given(stackUpdater.updateStackMetaData(anyLong(),anySet(),anyString())).willReturn(stack);
  given(stackUpdater.updateMetadataReady(1L,true)).willReturn(stack);
  given(consulPollingService.pollWithTimeout(any(ConsulServiceCheckerTask.class),any(ConsulContext.class),anyInt(),anyInt())).willReturn(PollingResult.SUCCESS).willReturn(PollingResult.EXIT);
  doNothing().when(underTest).updateWithConsulData(anySet());
  underTest.allocateRoles(1L);
  verify(consulPollingService,times(2)).pollWithTimeout(any(ConsulServiceCheckerTask.class),any(ConsulContext.class),anyInt(),anyInt());
}

Fixed version (ground truth):
@Test(expected=WrongMetadataException.class) public void testAllocateRolesWhenCannotConnectConsul(){
  stack.getInstanceGroupByInstanceGroupName(INSTANCE_GROUP_1).setInstanceMetaData(createInstanceMetaDataWithAmbariAddress(DUMMY_AMBARI_ADDRESS));
  stack.getInstanceGroupByInstanceGroupName(INSTANCE_GROUP_2).setInstanceMetaData(createInstanceMetaDataWithAmbariAddress(DUMMY_AMBARI_ADDRESS));
  given(stackRepository.findById(1L)).willReturn(stack);
  given(consulPollingService.pollWithTimeout(any(ConsulServiceCheckerTask.class),any(ConsulContext.class),anyInt(),anyInt())).willReturn(PollingResult.TIMEOUT).willReturn(PollingResult.EXIT);
  doNothing().when(underTest).updateWithConsulData(anySet());
  underTest.allocateRoles(1L);
}
Program: 63972
Project: 63972
Buggy source:
@Before public void setUp(){
  underTest=new AmbariRoleAllocator();
  MockitoAnnotations.initMocks(this);
  coreInstanceMetaData=createCoreInstanceMetaData();
  stack=createStack();
}

Fixed version (ground truth):
@Before public void setUp(){
  underTest=new AmbariRoleAllocator();
  MockitoAnnotations.initMocks(this);
  stack=createStack();
}
Program: 63973
Project: 63973
Buggy source:
@Bean public MailSender mailSender(){
  MailSender mailSender=null;
  if (isMailSendingConfigured()) {
    mailSender=new JavaMailSenderImpl();
    ((JavaMailSenderImpl)mailSender).setHost(host);
    ((JavaMailSenderImpl)mailSender).setPort(port);
    if (!StringUtils.isEmpty(userName)) {
      ((JavaMailSenderImpl)mailSender).setUsername(userName);
    }
    if (!StringUtils.isEmpty(password)) {
      ((JavaMailSenderImpl)mailSender).setPassword(password);
    }
    ((JavaMailSenderImpl)mailSender).setJavaMailProperties(getJavaMailProperties());
  }
 else {
    mailSender=new DummyEmailSender();
  }
  return mailSender;
}

Fixed version (ground truth):
@Bean public JavaMailSender mailSender(){
  JavaMailSender mailSender=null;
  if (isMailSendingConfigured()) {
    mailSender=new JavaMailSenderImpl();
    ((JavaMailSenderImpl)mailSender).setHost(host);
    ((JavaMailSenderImpl)mailSender).setPort(port);
    if (!StringUtils.isEmpty(userName)) {
      ((JavaMailSenderImpl)mailSender).setUsername(userName);
    }
    if (!StringUtils.isEmpty(password)) {
      ((JavaMailSenderImpl)mailSender).setPassword(password);
    }
    ((JavaMailSenderImpl)mailSender).setJavaMailProperties(getJavaMailProperties());
  }
 else {
    mailSender=new DummyEmailSender();
  }
  return mailSender;
}
Program: 63974
Project: 63974
Buggy source:
private void sendEmail(CbUser user,String template,Map<String,Object> model){
  try {
    String emailBody=processTemplateIntoString(freemarkerConfiguration.getTemplate(template,"String_Node_Str"),model);
    LOGGER.debug("String_Node_Str",emailBody);
    ((JavaMailSender)mailSender).send(prepareMessage(user,"String_Node_Str",emailBody));
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str");
    throw new CloudbreakRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void sendEmail(CbUser user,String template,Map<String,Object> model){
  try {
    String emailBody=processTemplateIntoString(freemarkerConfiguration.getTemplate(template,"String_Node_Str"),model);
    LOGGER.debug("String_Node_Str",emailBody);
    mailSender.send(prepareMessage(user,"String_Node_Str",emailBody));
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str");
    throw new CloudbreakRuntimeException("String_Node_Str",e);
  }
}
Program: 63975
Project: 63975
Buggy source:
private Set<InstanceGroup> convertInstanceGroups(List<InstanceGroupJson> instanceGroupJsons){
  return (Set<InstanceGroup>)getConversionService().convert(instanceGroupJsons,TypeDescriptor.forObject(instanceGroupJsons),TypeDescriptor.collection(Set.class,TypeDescriptor.valueOf(InstanceGroup.class)));
}

Fixed version (ground truth):
private Set<InstanceGroup> convertInstanceGroups(List<InstanceGroupJson> instanceGroupJsons,Stack stack){
  Set<InstanceGroup> convertedSet=(Set<InstanceGroup>)getConversionService().convert(instanceGroupJsons,TypeDescriptor.forObject(instanceGroupJsons),TypeDescriptor.collection(Set.class,TypeDescriptor.valueOf(InstanceGroup.class)));
  for (  InstanceGroup instanceGroup : convertedSet) {
    instanceGroup.setStack(stack);
  }
  return convertedSet;
}
Program: 63976
Project: 63976
Buggy source:
private Set<Subnet> convertSubnets(List<SubnetJson> source){
  return (Set<Subnet>)getConversionService().convert(source,TypeDescriptor.forObject(source),TypeDescriptor.collection(Set.class,TypeDescriptor.valueOf(Subnet.class)));
}

Fixed version (ground truth):
private Set<Subnet> convertSubnets(List<SubnetJson> source,Stack stack){
  Set<Subnet> convertedSet=(Set<Subnet>)getConversionService().convert(source,TypeDescriptor.forObject(source),TypeDescriptor.collection(Set.class,TypeDescriptor.valueOf(Subnet.class)));
  for (  Subnet subNet : convertedSet) {
    subNet.setStack(stack);
  }
  return convertedSet;
}
Program: 63978
Project: 63978
Buggy source:
private Set<HostGroup> convertHostGroupsFromJson(Long stackId,Cluster cluster,Set<HostGroupJson> hostGroupsJsons){
  Set<HostGroup> hostGroups=new HashSet<>();
  for (  HostGroupJson json : hostGroupsJsons) {
    HostGroup hostGroup=conversionService.convert(json,HostGroup.class);
    hostGroup=hostGroupDecorator.decorate(hostGroup,stackId,json.getInstanceGroupName(),json.getRecipeIds());
    hostGroups.add(hostGroup);
  }
  return hostGroups;
}

Fixed version (ground truth):
private Set<HostGroup> convertHostGroupsFromJson(Long stackId,Cluster cluster,Set<HostGroupJson> hostGroupsJsons){
  Set<HostGroup> hostGroups=new HashSet<>();
  for (  HostGroupJson json : hostGroupsJsons) {
    HostGroup hostGroup=conversionService.convert(json,HostGroup.class);
    hostGroup.setCluster(cluster);
    hostGroup=hostGroupDecorator.decorate(hostGroup,stackId,json.getInstanceGroupName(),json.getRecipeIds());
    hostGroups.add(hostGroup);
  }
  return hostGroups;
}
Program: 63980
Project: 63980
Buggy source:
@Override protected Object handleErrorFlow(Throwable throwable,ProvisioningContext data) throws Exception {
  LOGGER.info("String_Node_Str",getClass());
  return getFlowFacade().handleClusterCreationFailure((FlowContext)data);
}

Fixed version (ground truth):
@Override protected Object handleErrorFlow(Throwable throwable,ProvisioningContext data) throws Exception {
  LOGGER.info("String_Node_Str",getClass());
  data.setErrorReason(throwable.getMessage());
  return getFlowFacade().handleClusterCreationFailure((FlowContext)data);
}
Program: 63981
Project: 63981
Buggy source:
@Override public FlowContext handleClusterCreationFailure(FlowContext flowContext) throws CloudbreakException {
  LOGGER.debug("String_Node_Str",flowContext);
  ProvisioningContext context=(ProvisioningContext)flowContext;
  Cluster cluster=clusterService.updateClusterStatusByStackId(context.getStackId(),Status.CREATE_FAILED,context.getErrorReason());
  MDCBuilder.buildMdcContext(cluster);
  stackUpdater.updateStackStatus(context.getStackId(),Status.AVAILABLE,"String_Node_Str" + context.getErrorReason());
  eventService.fireCloudbreakEvent(context.getStackId(),"String_Node_Str",context.getErrorReason());
  if (cluster.getEmailNeeded()) {
    emailSenderService.sendFailureEmail(cluster.getOwner());
  }
  return context;
}

Fixed version (ground truth):
@Override public FlowContext handleClusterCreationFailure(FlowContext flowContext) throws CloudbreakException {
  LOGGER.debug("String_Node_Str",flowContext);
  ProvisioningContext context=(ProvisioningContext)flowContext;
  Cluster cluster=clusterService.updateClusterStatusByStackId(context.getStackId(),Status.CREATE_FAILED,context.getErrorReason());
  MDCBuilder.buildMdcContext(cluster);
  stackUpdater.updateStackStatus(context.getStackId(),Status.AVAILABLE,"String_Node_Str" + context.getErrorReason());
  eventService.fireCloudbreakEvent(context.getStackId(),Status.CREATE_FAILED.name(),context.getErrorReason());
  if (cluster.getEmailNeeded()) {
    emailSenderService.sendFailureEmail(cluster.getOwner());
  }
  return context;
}
Program: 63982
Project: 63982
Buggy source:
public ResourceRequestResultBuilder withResources(List<Resource> resources){
  this.resources=resources;
  return this;
}

Fixed version (ground truth):
public ResourceRequestResultBuilder withResources(Resource... resources){
  this.resources=Arrays.asList(resources);
  return this;
}
Program: 63986
Project: 63986
Buggy source:
@Override public ResourceRequestResult call() throws Exception {
  try {
    resourceBuilder.delete(resource,dCO,stack.getRegion());
  }
 catch (  Exception ex) {
    return ResourceRequestResult.ResourceRequestResultBuilder.builder().withException(ex).withFutureResult(FutureResult.FAILED).withInstanceGroup(stack.getInstanceGroupByInstanceGroupName(resource.getInstanceGroup())).build();
  }
  return ResourceRequestResult.ResourceRequestResultBuilder.builder().withFutureResult(FutureResult.SUCCESS).withInstanceGroup(stack.getInstanceGroupByInstanceGroupName(resource.getInstanceGroup())).build();
}

Fixed version (ground truth):
@Override public ResourceRequestResult call() throws Exception {
  try {
    resourceBuilder.delete(resource,dCO,stack.getRegion());
  }
 catch (  Exception ex) {
    return ResourceRequestResult.ResourceRequestResultBuilder.builder().withException(ex).withFutureResult(FutureResult.FAILED).withResources(resource).withInstanceGroup(stack.getInstanceGroupByInstanceGroupName(resource.getInstanceGroup())).build();
  }
  return ResourceRequestResult.ResourceRequestResultBuilder.builder().withFutureResult(FutureResult.SUCCESS).withInstanceGroup(stack.getInstanceGroupByInstanceGroupName(resource.getInstanceGroup())).build();
}
Program: 63987
Project: 63987
Buggy source:
@Override public ResourceRequestResult call() throws Exception {
  List<Resource> resources=new ArrayList<>();
  try {
    for (    final ResourceBuilder resourceBuilder : instanceResourceBuilders.get(stack.cloudPlatform())) {
      CreateResourceRequest createResourceRequest=resourceBuilder.buildCreateRequest(provisionContextObject,resources,resourceBuilder.buildResources(provisionContextObject,index,resources,Optional.of(stack.getInstanceGroupByInstanceGroupName(instanceGroup))),index,Optional.of(stack.getInstanceGroupByInstanceGroupName(instanceGroup)));
      stackUpdater.addStackResources(stack.getId(),createResourceRequest.getBuildableResources());
      resources.addAll(createResourceRequest.getBuildableResources());
      resourceBuilder.create(createResourceRequest,stack.getRegion());
    }
  }
 catch (  Exception ex) {
    return ResourceRequestResult.ResourceRequestResultBuilder.builder().withException(ex).withFutureResult(FutureResult.FAILED).withInstanceGroup(stack.getInstanceGroupByInstanceGroupName(instanceGroup)).build();
  }
  return ResourceRequestResult.ResourceRequestResultBuilder.builder().withFutureResult(FutureResult.SUCCESS).withBuildedResources(resources).withInstanceGroup(stack.getInstanceGroupByInstanceGroupName(instanceGroup)).build();
}

Fixed version (ground truth):
@Override public ResourceRequestResult call() throws Exception {
  List<Resource> resources=new ArrayList<>();
  try {
    for (    final ResourceBuilder resourceBuilder : instanceResourceBuilders.get(stack.cloudPlatform())) {
      CreateResourceRequest createResourceRequest=resourceBuilder.buildCreateRequest(provisionContextObject,resources,resourceBuilder.buildResources(provisionContextObject,index,resources,Optional.of(stack.getInstanceGroupByInstanceGroupName(instanceGroup))),index,Optional.of(stack.getInstanceGroupByInstanceGroupName(instanceGroup)));
      stackUpdater.addStackResources(stack.getId(),createResourceRequest.getBuildableResources());
      resources.addAll(createResourceRequest.getBuildableResources());
      resourceBuilder.create(createResourceRequest,stack.getRegion());
    }
  }
 catch (  Exception ex) {
    return ResourceRequestResult.ResourceRequestResultBuilder.builder().withException(ex).withResources(resources).withFutureResult(FutureResult.FAILED).withInstanceGroup(stack.getInstanceGroupByInstanceGroupName(instanceGroup)).build();
  }
  return ResourceRequestResult.ResourceRequestResultBuilder.builder().withFutureResult(FutureResult.SUCCESS).withBuildedResources(resources).withInstanceGroup(stack.getInstanceGroupByInstanceGroupName(instanceGroup)).build();
}
Program: 63988
Project: 63988
Buggy source:
@Test public void buildStackWhenAllResourceBuilderWorksFine() throws Exception {
  prepareInstanceResourceBuilders();
  prepareNetWorkResourceBuilders();
  Map<FutureResult,List<ResourceRequestResult>> futureResultListHashMap=new HashMap<>();
  futureResultListHashMap.put(FutureResult.FAILED,new ArrayList<ResourceRequestResult>());
  futureResultListHashMap.put(FutureResult.SUCCESS,new ArrayList<ResourceRequestResult>());
  when(provisionUtil.waitForRequestToFinish(anyLong(),anyList())).thenReturn(futureResultListHashMap);
  when(stackRepository.findById(anyLong())).thenReturn(stack);
  doNothing().when(provisionUtil).checkErrorOccurred(anyMap());
  given(stackRepository.findOneWithLists(1L)).willReturn(stack);
  doNothing().when(stackFailureHandlerService).handleFailure(any(Stack.class),anyList());
  given(stackUpdater.updateStackStatus(anyLong(),any(Status.class),anyString())).willReturn(stack);
  given(stackUpdater.updateStackStatusReason(anyLong(),anyString())).willReturn(stack);
  given(stackUpdater.addStackResources(anyLong(),anyList())).willReturn(stack);
  given(reactor.notify(any(),any(Event.class))).willReturn(null);
  given(userDataBuilder.build(any(CloudPlatform.class),anyString(),anyInt(),anyMap())).willReturn(DUMMY_NAME);
  underTest.buildStack(cloudPlatform,1L,setupProperties,userDataParams);
  verify(reactor,times(1)).notify(eq(ReactorConfig.PROVISION_COMPLETE_EVENT),Event.wrap(anyObject()));
}

Fixed version (ground truth):
@Test public void buildStackWhenAllResourceBuilderWorksFine() throws Exception {
  prepareInstanceResourceBuilders();
  prepareNetWorkResourceBuilders();
  Map<FutureResult,List<ResourceRequestResult>> futureResultListHashMap=new HashMap<>();
  futureResultListHashMap.put(FutureResult.FAILED,new ArrayList<ResourceRequestResult>());
  futureResultListHashMap.put(FutureResult.SUCCESS,new ArrayList<ResourceRequestResult>());
  when(provisionUtil.waitForRequestToFinish(anyLong(),anyList())).thenReturn(futureResultListHashMap);
  when(stackRepository.findById(anyLong())).thenReturn(stack);
  given(stackRepository.findOneWithLists(1L)).willReturn(stack);
  doNothing().when(stackFailureHandlerService).handleFailure(any(Stack.class),anyList());
  given(stackUpdater.updateStackStatus(anyLong(),any(Status.class),anyString())).willReturn(stack);
  given(stackUpdater.updateStackStatusReason(anyLong(),anyString())).willReturn(stack);
  given(stackUpdater.addStackResources(anyLong(),anyList())).willReturn(stack);
  given(reactor.notify(any(),any(Event.class))).willReturn(null);
  given(userDataBuilder.build(any(CloudPlatform.class),anyString(),anyInt(),anyMap())).willReturn(DUMMY_NAME);
  underTest.buildStack(cloudPlatform,1L,setupProperties,userDataParams);
  verify(reactor,times(1)).notify(eq(ReactorConfig.PROVISION_COMPLETE_EVENT),Event.wrap(anyObject()));
}
Program: 63989
Project: 63989
Buggy source:
private void updateInstanceMetadata(Stack stack,AmazonEC2Client amazonEC2Client,Set<InstanceMetaData> instanceMetaData,Collection<String> instances){
  MDCBuilder.buildMdcContext(stack);
  DescribeInstancesResult describeResult=amazonEC2Client.describeInstances(new DescribeInstancesRequest().withInstanceIds(instances));
  for (  Reservation reservation : describeResult.getReservations()) {
    for (    Instance instance : reservation.getInstances()) {
      for (      InstanceMetaData metaData : instanceMetaData) {
        if (metaData.getInstanceId().equals(instance.getInstanceId())) {
          String publicDnsName=instance.getPublicDnsName();
          if (metaData.getAmbariServer()) {
            stack.setAmbariIp(publicDnsName);
            Cluster cluster=clusterRepository.findOneWithLists(stack.getCluster().getId());
            stack.setCluster(cluster);
            stackRepository.save(stack);
          }
          metaData.setPublicIp(publicDnsName);
          instanceMetaDataRepository.save(metaData);
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
private void updateInstanceMetadata(Stack stack,AmazonEC2Client amazonEC2Client,Set<InstanceMetaData> instanceMetaData,Collection<String> instances){
  MDCBuilder.buildMdcContext(stack);
  DescribeInstancesResult describeResult=amazonEC2Client.describeInstances(new DescribeInstancesRequest().withInstanceIds(instances));
  for (  Reservation reservation : describeResult.getReservations()) {
    for (    Instance instance : reservation.getInstances()) {
      for (      InstanceMetaData metaData : instanceMetaData) {
        if (metaData.getInstanceId().equals(instance.getInstanceId())) {
          String publicIp=instance.getPublicIpAddress();
          if (metaData.getAmbariServer()) {
            stack.setAmbariIp(publicIp);
            Cluster cluster=clusterRepository.findOneWithLists(stack.getCluster().getId());
            stack.setCluster(cluster);
            stackRepository.save(stack);
          }
          metaData.setPublicIp(publicIp);
          instanceMetaDataRepository.save(metaData);
          break;
        }
      }
    }
  }
}
Program: 63990
Project: 63990
Buggy source:
private void waitForConsulAgents(Stack stack,Set<InstanceMetaData> originalMetaData,Set<InstanceMetaData> instancesMetaData){
  Set<InstanceMetaData> copy=new HashSet<>(originalMetaData);
  copy.removeAll(instancesMetaData);
  List<ConsulClient> clients=createClients(copy);
  List<String> privateIps=new ArrayList<>(instancesMetaData.size());
  for (  InstanceMetaData instance : instancesMetaData) {
    privateIps.add(instance.getPrivateIp());
  }
  consulPollingService.pollWithTimeout(new ConsulHostCheckerTask(),new ConsulContext(stack,clients,privateIps),POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
}

Fixed version (ground truth):
private void waitForConsulAgents(Stack stack,Set<InstanceMetaData> originalMetaData,Set<InstanceMetaData> instancesMetaData){
  Set<InstanceMetaData> copy=new HashSet<>(originalMetaData);
  copy.removeAll(instancesMetaData);
  List<ConsulClient> clients=createClients(copy);
  List<String> privateIps=new ArrayList<>();
  if (instancesMetaData.isEmpty()) {
    for (    InstanceMetaData instance : originalMetaData) {
      privateIps.add(instance.getPrivateIp());
    }
  }
 else {
    for (    InstanceMetaData instance : instancesMetaData) {
      privateIps.add(instance.getPrivateIp());
    }
  }
  consulPollingService.pollWithTimeout(new ConsulHostCheckerTask(),new ConsulContext(stack,clients,privateIps),POLLING_INTERVAL,MAX_POLLING_ATTEMPTS);
}
Program: 63993
Project: 63993
Buggy source:
private void delete(Stack stack,CbUser user){
  MDCBuilder.buildMdcContext(stack);
  LOGGER.info("String_Node_Str");
  if (!user.getUserId().equals(stack.getOwner()) && !user.getRoles().contains(CbUserRole.ADMIN)) {
    throw new BadRequestException("String_Node_Str");
  }
 else {
    LOGGER.info("String_Node_Str",ReactorConfig.DELETE_REQUEST_EVENT);
    reactor.notify(ReactorConfig.DELETE_REQUEST_EVENT,Event.wrap(new StackDeleteRequest(stack.getTemplate().cloudPlatform(),stack.getId())));
  }
}

Fixed version (ground truth):
private void delete(Stack stack,CbUser user){
  MDCBuilder.buildMdcContext(stack);
  LOGGER.info("String_Node_Str");
  if (!user.getUserId().equals(stack.getOwner()) && !user.getRoles().contains(CbUserRole.ADMIN)) {
    throw new BadRequestException("String_Node_Str");
  }
 else {
    LOGGER.info("String_Node_Str",ReactorConfig.DELETE_REQUEST_EVENT);
    reactor.notify(ReactorConfig.DELETE_REQUEST_EVENT,Event.wrap(new StackDeleteRequest(stack.cloudPlatform(),stack.getId())));
  }
}
Program: 63995
Project: 63995
Buggy source:
@Override public AzureDeleteContextObject deleteInit(Stack stack) throws Exception {
  AzureCredential credential=(AzureCredential)stack.getCredential();
  AzureTemplate template=(AzureTemplate)stack.getTemplate();
  AzureClient azureClient=azureStackUtil.createAzureClient((AzureCredential)stack.getCredential());
  AzureDeleteContextObject azureDeleteContextObject=new AzureDeleteContextObject(stack.getId(),credential.getCommonName(template.getLocation()),azureClient);
  return azureDeleteContextObject;
}

Fixed version (ground truth):
@Override public AzureDeleteContextObject deleteInit(Stack stack) throws Exception {
  AzureCredential credential=(AzureCredential)stack.getCredential();
  AzureLocation azureLocation=AzureLocation.valueOf(stack.getRegion());
  AzureClient azureClient=azureStackUtil.createAzureClient((AzureCredential)stack.getCredential());
  AzureDeleteContextObject azureDeleteContextObject=new AzureDeleteContextObject(stack.getId(),credential.getCommonName(azureLocation),azureClient);
  return azureDeleteContextObject;
}
Program: 63996
Project: 63996
Buggy source:
@Override public AzureProvisionContextObject provisionInit(Stack stack,String userData) throws Exception {
  AzureCredential credential=(AzureCredential)stack.getCredential();
  AzureTemplate template=(AzureTemplate)stack.getTemplate();
  AzureClient azureClient=azureStackUtil.createAzureClient((AzureCredential)stack.getCredential());
  AzureProvisionContextObject azureProvisionContextObject=new AzureProvisionContextObject(stack.getId(),credential.getCommonName(template.getLocation()),azureClient,getOsImageName(credential,template.getLocation()),userData);
  return azureProvisionContextObject;
}

Fixed version (ground truth):
@Override public AzureProvisionContextObject provisionInit(Stack stack,String userData) throws Exception {
  AzureCredential credential=(AzureCredential)stack.getCredential();
  AzureLocation azureLocation=AzureLocation.valueOf(stack.getRegion());
  AzureClient azureClient=azureStackUtil.createAzureClient((AzureCredential)stack.getCredential());
  AzureProvisionContextObject azureProvisionContextObject=new AzureProvisionContextObject(stack.getId(),credential.getCommonName(azureLocation),azureClient,getOsImageName(credential,azureLocation),userData);
  return azureProvisionContextObject;
}
Program: 63997
Project: 63997
Buggy source:
@Override public AzureDeleteContextObject decommissionInit(Stack stack,Set<String> decommissionSet) throws Exception {
  AzureCredential credential=(AzureCredential)stack.getCredential();
  AzureTemplate template=(AzureTemplate)stack.getTemplate();
  AzureClient azureClient=azureStackUtil.createAzureClient((AzureCredential)stack.getCredential());
  List<Resource> resourceList=new ArrayList<>();
  for (  String res : decommissionSet) {
    List<TemplateGroup> templateGroups=Lists.newArrayList(stack.getTemplateGroups());
    resourceList.add(new Resource(ResourceType.AZURE_VIRTUAL_MACHINE,res,stack,templateGroups.get(0).getGroupName()));
    resourceList.add(new Resource(ResourceType.AZURE_SERVICE_CERTIFICATE,res,stack,templateGroups.get(0).getGroupName()));
    resourceList.add(new Resource(ResourceType.AZURE_CLOUD_SERVICE,res,stack,templateGroups.get(0).getGroupName()));
  }
  AzureDeleteContextObject azureDeleteContextObject=new AzureDeleteContextObject(stack.getId(),credential.getCommonName(template.getLocation()),azureClient,resourceList);
  return azureDeleteContextObject;
}

Fixed version (ground truth):
@Override public AzureDeleteContextObject decommissionInit(Stack stack,Set<String> decommissionSet) throws Exception {
  AzureCredential credential=(AzureCredential)stack.getCredential();
  AzureLocation azureLocation=AzureLocation.valueOf(stack.getRegion());
  AzureClient azureClient=azureStackUtil.createAzureClient((AzureCredential)stack.getCredential());
  List<Resource> resourceList=new ArrayList<>();
  for (  String res : decommissionSet) {
    List<TemplateGroup> templateGroups=Lists.newArrayList(stack.getTemplateGroups());
    resourceList.add(new Resource(ResourceType.AZURE_VIRTUAL_MACHINE,res,stack,templateGroups.get(0).getGroupName()));
    resourceList.add(new Resource(ResourceType.AZURE_SERVICE_CERTIFICATE,res,stack,templateGroups.get(0).getGroupName()));
    resourceList.add(new Resource(ResourceType.AZURE_CLOUD_SERVICE,res,stack,templateGroups.get(0).getGroupName()));
  }
  AzureDeleteContextObject azureDeleteContextObject=new AzureDeleteContextObject(stack.getId(),credential.getCommonName(azureLocation),azureClient,resourceList);
  return azureDeleteContextObject;
}
Program: 63998
Project: 63998
Buggy source:
@Override public AzureDescribeContextObject describeInit(Stack stack) throws Exception {
  AzureCredential credential=(AzureCredential)stack.getCredential();
  AzureTemplate template=(AzureTemplate)stack.getTemplate();
  AzureClient azureClient=azureStackUtil.createAzureClient((AzureCredential)stack.getCredential());
  AzureDescribeContextObject azureDescribeContextObject=new AzureDescribeContextObject(stack.getId(),credential.getCommonName(template.getLocation()),azureClient);
  return azureDescribeContextObject;
}

Fixed version (ground truth):
@Override public AzureDescribeContextObject describeInit(Stack stack) throws Exception {
  AzureCredential credential=(AzureCredential)stack.getCredential();
  AzureLocation azureLocation=AzureLocation.valueOf(stack.getRegion());
  AzureClient azureClient=azureStackUtil.createAzureClient((AzureCredential)stack.getCredential());
  AzureDescribeContextObject azureDescribeContextObject=new AzureDescribeContextObject(stack.getId(),credential.getCommonName(azureLocation),azureClient);
  return azureDescribeContextObject;
}