Program: 14120
Project: 14120
Buggy source:
public GetTemplateSummaryResponseType getTemplateSummary(GetTemplateSummaryType request) throws CloudFormationException {
  GetTemplateSummaryResponseType reply=request.getReply();
  try {
    final Context ctx=Contexts.lookup();
    final User user=ctx.getUser();
    final String userId=user.getUserId();
    final String accountId=user.getAccountNumber();
    final String templateBody=request.getTemplateBody();
    final String templateUrl=request.getTemplateURL();
    final String stackName=request.getStackName();
    if (templateBody == null && templateUrl == null && stackName == null)     throw new ValidationErrorException("String_Node_Str");
    if (templateBody != null && templateUrl != null && stackName != null)     throw new ValidationErrorException("String_Node_Str");
    String templateText;
    if (stackName != null) {
      checkStackPermission(ctx,stackName,accountId);
      final StackEntity stackEntity=StackEntityManager.getAnyStackByNameOrId(stackName,ctx.isAdministrator() && stackName.startsWith(STACK_ID_PREFIX) ? null : accountId);
      if (stackEntity == null) {
        throw new ValidationErrorException("String_Node_Str" + stackName + "String_Node_Str");
      }
      templateText=stackEntity.getTemplateBody();
    }
 else {
      checkActionPermission(CloudFormationPolicySpec.CLOUDFORMATION_GETTEMPLATESUMMARY,ctx);
      if (templateBody != null) {
        if (templateBody.getBytes().length > Limits.REQUEST_TEMPLATE_BODY_MAX_LENGTH_BYTES) {
          throw new ValidationErrorException("String_Node_Str" + Limits.REQUEST_TEMPLATE_BODY_MAX_LENGTH_BYTES + "String_Node_Str");
        }
      }
      templateText=(templateBody != null) ? templateBody : extractTemplateTextFromURL(templateUrl,user);
    }
    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);
    ArrayList<String> notificationArns=Lists.newArrayList();
    pseudoParameterValues.setRegion(getRegion());
    List<Parameter> parameters=Lists.newArrayList();
    final GetTemplateSummaryResult getTemplateSummaryResult=new TemplateParser().getTemplateSummary(templateText,parameters,pseudoParameterValues,userId);
    reply.setGetTemplateSummaryResult(getTemplateSummaryResult);
  }
 catch (  Exception ex) {
    handleException(ex);
  }
  return reply;
}

Fixed version (ground truth):
public GetTemplateSummaryResponseType getTemplateSummary(GetTemplateSummaryType request) throws CloudFormationException {
  GetTemplateSummaryResponseType reply=request.getReply();
  try {
    final Context ctx=Contexts.lookup();
    final User user=ctx.getUser();
    final String userId=user.getUserId();
    final String accountId=user.getAccountNumber();
    final String templateBody=request.getTemplateBody();
    final String templateUrl=request.getTemplateURL();
    final String stackName=request.getStackName();
    int numNonNullParamsInTemplateBodyTemplateURLAndStackName=0;
    if (templateBody != null)     numNonNullParamsInTemplateBodyTemplateURLAndStackName++;
    if (templateUrl != null)     numNonNullParamsInTemplateBodyTemplateURLAndStackName++;
    if (stackName != null)     numNonNullParamsInTemplateBodyTemplateURLAndStackName++;
    if (numNonNullParamsInTemplateBodyTemplateURLAndStackName == 0)     throw new ValidationErrorException("String_Node_Str");
    if (numNonNullParamsInTemplateBodyTemplateURLAndStackName > 1)     throw new ValidationErrorException("String_Node_Str");
    String templateText;
    if (stackName != null) {
      checkStackPermission(ctx,stackName,accountId);
      final StackEntity stackEntity=StackEntityManager.getAnyStackByNameOrId(stackName,ctx.isAdministrator() && stackName.startsWith(STACK_ID_PREFIX) ? null : accountId);
      if (stackEntity == null) {
        throw new ValidationErrorException("String_Node_Str" + stackName + "String_Node_Str");
      }
      templateText=stackEntity.getTemplateBody();
    }
 else {
      checkActionPermission(CloudFormationPolicySpec.CLOUDFORMATION_GETTEMPLATESUMMARY,ctx);
      if (templateBody != null) {
        if (templateBody.getBytes().length > Limits.REQUEST_TEMPLATE_BODY_MAX_LENGTH_BYTES) {
          throw new ValidationErrorException("String_Node_Str" + Limits.REQUEST_TEMPLATE_BODY_MAX_LENGTH_BYTES + "String_Node_Str");
        }
      }
      templateText=(templateBody != null) ? templateBody : extractTemplateTextFromURL(templateUrl,user);
    }
    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);
    ArrayList<String> notificationArns=Lists.newArrayList();
    pseudoParameterValues.setRegion(getRegion());
    List<Parameter> parameters=Lists.newArrayList();
    final GetTemplateSummaryResult getTemplateSummaryResult=new TemplateParser().getTemplateSummary(templateText,parameters,pseudoParameterValues,userId);
    reply.setGetTemplateSummaryResult(getTemplateSummaryResult);
  }
 catch (  Exception ex) {
    handleException(ex);
  }
  return reply;
}