Program: 14230
Project: 14230
Buggy source:
public CreateStackResponseType createStack(CreateStackType request) throws CloudFormationException {
  CreateStackResponseType reply=request.getReply();
  try {
    final Context ctx=Contexts.lookup();
    final User user=ctx.getUser();
    final String userId=user.getUserId();
    final String accountId=user.getAccount().getAccountNumber();
    final String stackName=request.getStackName();
    final String templateBody=request.getTemplateBody();
    if (stackName == null)     throw new ValidationErrorException("String_Node_Str");
    if (templateBody == null)     throw new ValidationErrorException("String_Node_Str");
    List<Parameter> parameters=null;
    if (request.getParameters() != null && request.getParameters().getMember() != null) {
      parameters=request.getParameters().getMember();
    }
    final String stackIdLocal=UUID.randomUUID().toString();
    final String stackId="String_Node_Str" + REGION + "String_Node_Str"+ accountId+ "String_Node_Str"+ stackName+ "String_Node_Str"+ stackIdLocal;
    final PseudoParameterValues pseudoParameterValues=new PseudoParameterValues();
    pseudoParameterValues.setAccountId(accountId);
    pseudoParameterValues.setStackName(stackName);
    pseudoParameterValues.setStackId(stackId);
    if (request.getNotificationARNs() != null && request.getNotificationARNs().getMember() != null) {
      ArrayList<String> notificationArns=Lists.newArrayList();
      for (      String notificationArn : request.getNotificationARNs().getMember()) {
        notificationArns.add(notificationArn);
      }
      pseudoParameterValues.setNotificationArns(notificationArns);
    }
    pseudoParameterValues.setRegion(REGION);
    final List<String> defaultRegionAvailabilityZones=describeAvailabilityZones(userId);
    final Map<String,List<String>> availabilityZones=Maps.newHashMap();
    availabilityZones.put(REGION,defaultRegionAvailabilityZones);
    availabilityZones.put("String_Node_Str",defaultRegionAvailabilityZones);
    pseudoParameterValues.setAvailabilityZones(availabilityZones);
    final Template template=new TemplateParser().parse(templateBody,parameters,pseudoParameterValues);
    template.getStackEntity().setStackName(stackName);
    template.getStackEntity().setStackId(stackId);
    template.getStackEntity().setAccountId(accountId);
    template.getStackEntity().setStackStatus(StackEntity.Status.CREATE_IN_PROGRESS);
    template.getStackEntity().setStackStatusReason("String_Node_Str");
    template.getStackEntity().setDisableRollback(request.getDisableRollback() == Boolean.TRUE);
    template.getStackEntity().setCreationTimestamp(new Date());
    if (request.getCapabilities() != null && request.getCapabilities().getMember() != null) {
      template.getStackEntity().setCapabilitiesJson(StackEntityHelper.capabilitiesToJson(request.getCapabilities().getMember()));
    }
    if (request.getNotificationARNs() != null && request.getNotificationARNs().getMember() != null) {
      template.getStackEntity().setNotificationARNsJson(StackEntityHelper.notificationARNsToJson(request.getNotificationARNs().getMember()));
    }
    if (request.getTags() != null && request.getTags().getMember() != null) {
      template.getStackEntity().setTagsJson(StackEntityHelper.tagsToJson(request.getTags().getMember()));
    }
    if (request.getDisableRollback() != null && request.getOnFailure() != null && !request.getOnFailure().isEmpty()) {
      throw new ValidationErrorException("String_Node_Str");
    }
    template.getStackEntity().setRecordDeleted(Boolean.FALSE);
    String onFailure="String_Node_Str";
    if (request.getOnFailure() != null && !request.getOnFailure().isEmpty()) {
      if (!request.getOnFailure().equals("String_Node_Str") && !request.getOnFailure().equals("String_Node_Str") && !request.getOnFailure().equals("String_Node_Str")) {
        throw new ValidationErrorException("String_Node_Str" + request.getOnFailure() + "String_Node_Str"+ "String_Node_Str");
      }
 else {
        onFailure=request.getOnFailure();
      }
    }
 else {
      onFailure=(request.getDisableRollback() == Boolean.FALSE) ? "String_Node_Str" : "String_Node_Str";
    }
    StackEntityManager.addStack(template.getStackEntity());
    for (    ResourceInfo resourceInfo : template.getResourceInfoMap().values()) {
      StackResourceEntity stackResourceEntity=new StackResourceEntity();
      stackResourceEntity=StackResourceEntityManager.updateResourceInfo(stackResourceEntity,resourceInfo);
      stackResourceEntity.setDescription("String_Node_Str");
      stackResourceEntity.setResourceStatus(StackResourceEntity.Status.NOT_STARTED);
      stackResourceEntity.setStackId(stackId);
      stackResourceEntity.setStackName(stackName);
      stackResourceEntity.setRecordDeleted(Boolean.FALSE);
      StackResourceEntityManager.addStackResource(stackResourceEntity);
    }
    new StackCreator(template.getStackEntity(),userId,onFailure).start();
    CreateStackResult createStackResult=new CreateStackResult();
    createStackResult.setStackId(stackId);
    reply.setCreateStackResult(createStackResult);
  }
 catch (  Exception ex) {
    LOG.error(ex,ex);
    throw new ValidationErrorException(ex.getMessage());
  }
  return reply;
}

Fixed version (ground truth):
public CreateStackResponseType createStack(CreateStackType request) throws CloudFormationException {
  CreateStackResponseType reply=request.getReply();
  try {
    final Context ctx=Contexts.lookup();
    checkActionPermission(PolicySpec.CLOUDFORMATION_CREATESTACK,ctx);
    final User user=ctx.getUser();
    final String userId=user.getUserId();
    final String accountId=user.getAccount().getAccountNumber();
    final String stackName=request.getStackName();
    final String templateBody=request.getTemplateBody();
    if (stackName == null)     throw new ValidationErrorException("String_Node_Str");
    if (templateBody == null)     throw new ValidationErrorException("String_Node_Str");
    List<Parameter> parameters=null;
    if (request.getParameters() != null && request.getParameters().getMember() != null) {
      parameters=request.getParameters().getMember();
    }
    final String stackIdLocal=UUID.randomUUID().toString();
    final String stackId="String_Node_Str" + REGION + "String_Node_Str"+ accountId+ "String_Node_Str"+ stackName+ "String_Node_Str"+ stackIdLocal;
    final PseudoParameterValues pseudoParameterValues=new PseudoParameterValues();
    pseudoParameterValues.setAccountId(accountId);
    pseudoParameterValues.setStackName(stackName);
    pseudoParameterValues.setStackId(stackId);
    if (request.getNotificationARNs() != null && request.getNotificationARNs().getMember() != null) {
      ArrayList<String> notificationArns=Lists.newArrayList();
      for (      String notificationArn : request.getNotificationARNs().getMember()) {
        notificationArns.add(notificationArn);
      }
      pseudoParameterValues.setNotificationArns(notificationArns);
    }
    pseudoParameterValues.setRegion(REGION);
    final List<String> defaultRegionAvailabilityZones=describeAvailabilityZones(userId);
    final Map<String,List<String>> availabilityZones=Maps.newHashMap();
    availabilityZones.put(REGION,defaultRegionAvailabilityZones);
    availabilityZones.put("String_Node_Str",defaultRegionAvailabilityZones);
    pseudoParameterValues.setAvailabilityZones(availabilityZones);
    final Template template=new TemplateParser().parse(templateBody,parameters,pseudoParameterValues,false);
    template.getStackEntity().setStackName(stackName);
    template.getStackEntity().setStackId(stackId);
    template.getStackEntity().setAccountId(accountId);
    template.getStackEntity().setStackStatus(StackEntity.Status.CREATE_IN_PROGRESS);
    template.getStackEntity().setStackStatusReason("String_Node_Str");
    template.getStackEntity().setDisableRollback(request.getDisableRollback() == Boolean.TRUE);
    template.getStackEntity().setCreationTimestamp(new Date());
    if (request.getCapabilities() != null && request.getCapabilities().getMember() != null) {
      template.getStackEntity().setCapabilitiesJson(StackEntityHelper.capabilitiesToJson(request.getCapabilities().getMember()));
    }
    if (request.getNotificationARNs() != null && request.getNotificationARNs().getMember() != null) {
      template.getStackEntity().setNotificationARNsJson(StackEntityHelper.notificationARNsToJson(request.getNotificationARNs().getMember()));
    }
    if (request.getTags() != null && request.getTags().getMember() != null) {
      template.getStackEntity().setTagsJson(StackEntityHelper.tagsToJson(request.getTags().getMember()));
    }
    if (request.getDisableRollback() != null && request.getOnFailure() != null && !request.getOnFailure().isEmpty()) {
      throw new ValidationErrorException("String_Node_Str");
    }
    template.getStackEntity().setRecordDeleted(Boolean.FALSE);
    String onFailure="String_Node_Str";
    if (request.getOnFailure() != null && !request.getOnFailure().isEmpty()) {
      if (!request.getOnFailure().equals("String_Node_Str") && !request.getOnFailure().equals("String_Node_Str") && !request.getOnFailure().equals("String_Node_Str")) {
        throw new ValidationErrorException("String_Node_Str" + request.getOnFailure() + "String_Node_Str"+ "String_Node_Str");
      }
 else {
        onFailure=request.getOnFailure();
      }
    }
 else {
      onFailure=(request.getDisableRollback() == Boolean.FALSE) ? "String_Node_Str" : "String_Node_Str";
    }
    StackEntityManager.addStack(template.getStackEntity());
    for (    ResourceInfo resourceInfo : template.getResourceInfoMap().values()) {
      StackResourceEntity stackResourceEntity=new StackResourceEntity();
      stackResourceEntity=StackResourceEntityManager.updateResourceInfo(stackResourceEntity,resourceInfo);
      stackResourceEntity.setDescription("String_Node_Str");
      stackResourceEntity.setResourceStatus(StackResourceEntity.Status.NOT_STARTED);
      stackResourceEntity.setStackId(stackId);
      stackResourceEntity.setStackName(stackName);
      stackResourceEntity.setRecordDeleted(Boolean.FALSE);
      StackResourceEntityManager.addStackResource(stackResourceEntity);
    }
    new StackCreator(template.getStackEntity(),userId,onFailure).start();
    CreateStackResult createStackResult=new CreateStackResult();
    createStackResult.setStackId(stackId);
    reply.setCreateStackResult(createStackResult);
  }
 catch (  Exception ex) {
    handleException(ex);
  }
  return reply;
}