Program: 14121
Project: 14121
Buggy source:
public GetTemplateSummaryResult getTemplateSummary(String templateBody,List<Parameter> userParameters,PseudoParameterValues pseudoParameterValues,String effectiveUserId) throws CloudFormationException {
  Template template=new Template();
  template.setResourceInfoMap(Maps.<String,ResourceInfo>newLinkedHashMap());
  JsonNode templateJsonNode=null;
  try {
    templateJsonNode=objectMapper.readTree(templateBody);
  }
 catch (  IOException ex) {
    throw new ValidationErrorException(ex.getMessage());
  }
  if (!templateJsonNode.isObject()) {
    throw new ValidationErrorException("String_Node_Str");
  }
  template.setTemplateBody(templateBody);
  addPseudoParameters(template,pseudoParameterValues);
  buildResourceMap(template,templateJsonNode);
  parseValidTopLevelKeys(templateJsonNode);
  parseVersion(template,templateJsonNode);
  parseDescription(template,templateJsonNode);
  parseMappings(template,templateJsonNode);
  ParameterParser.parseParameters(template,templateJsonNode,userParameters,true);
  parseConditions(template,templateJsonNode,true,effectiveUserId);
  parseResources(template,templateJsonNode,true);
  parseOutputs(template,templateJsonNode);
  Set<String> capabilitiesResourceTypes=Sets.newLinkedHashSet();
  Set<String> requiredCapabilities=Sets.newLinkedHashSet();
  for (  ResourceInfo resourceInfo : template.getResourceInfoMap().values()) {
    if (resourceInfo.getRequiredCapabilities() != null && !resourceInfo.getRequiredCapabilities().isEmpty()) {
      requiredCapabilities.addAll(resourceInfo.getRequiredCapabilities());
      capabilitiesResourceTypes.add(resourceInfo.getType());
    }
  }
  GetTemplateSummaryResult getTemplateSummaryResult=new GetTemplateSummaryResult();
  getTemplateSummaryResult.setDescription(template.getDescription());
  getTemplateSummaryResult.setCapabilities(new ResourceList());
  getTemplateSummaryResult.getCapabilities().setMember(Lists.newArrayList(requiredCapabilities));
  if (!requiredCapabilities.isEmpty()) {
    getTemplateSummaryResult.setCapabilitiesReason("String_Node_Str" + capabilitiesResourceTypes);
  }
  getTemplateSummaryResult.setParameters(new ParameterDeclarations());
  getTemplateSummaryResult.getParameters().setMember(template.getParameterDeclarations());
  getTemplateSummaryResult.setMetadata(template.getMetadataJSON());
  return getTemplateSummaryResult;
}

Fixed version (ground truth):
public GetTemplateSummaryResult getTemplateSummary(String templateBody,List<Parameter> userParameters,PseudoParameterValues pseudoParameterValues,String effectiveUserId) throws CloudFormationException {
  Template template=new Template();
  template.setResourceInfoMap(Maps.<String,ResourceInfo>newLinkedHashMap());
  JsonNode templateJsonNode=null;
  try {
    templateJsonNode=objectMapper.readTree(templateBody);
  }
 catch (  IOException ex) {
    throw new ValidationErrorException(ex.getMessage());
  }
  if (!templateJsonNode.isObject()) {
    throw new ValidationErrorException("String_Node_Str");
  }
  template.setTemplateBody(templateBody);
  addPseudoParameters(template,pseudoParameterValues);
  buildResourceMap(template,templateJsonNode);
  parseValidTopLevelKeys(templateJsonNode);
  parseVersion(template,templateJsonNode);
  parseDescription(template,templateJsonNode);
  parseMetadata(template,templateJsonNode);
  parseMappings(template,templateJsonNode);
  ParameterParser.parseParameters(template,templateJsonNode,userParameters,true);
  parseConditions(template,templateJsonNode,true,effectiveUserId);
  parseResources(template,templateJsonNode,true);
  parseOutputs(template,templateJsonNode);
  Set<String> capabilitiesResourceTypes=Sets.newLinkedHashSet();
  Set<String> requiredCapabilities=Sets.newLinkedHashSet();
  for (  ResourceInfo resourceInfo : template.getResourceInfoMap().values()) {
    if (resourceInfo.getRequiredCapabilities() != null && !resourceInfo.getRequiredCapabilities().isEmpty()) {
      requiredCapabilities.addAll(resourceInfo.getRequiredCapabilities());
      capabilitiesResourceTypes.add(resourceInfo.getType());
    }
  }
  GetTemplateSummaryResult getTemplateSummaryResult=new GetTemplateSummaryResult();
  getTemplateSummaryResult.setDescription(template.getDescription());
  getTemplateSummaryResult.setCapabilities(new ResourceList());
  getTemplateSummaryResult.getCapabilities().setMember(Lists.newArrayList(requiredCapabilities));
  if (!requiredCapabilities.isEmpty()) {
    getTemplateSummaryResult.setCapabilitiesReason("String_Node_Str" + capabilitiesResourceTypes);
  }
  getTemplateSummaryResult.setParameters(new ParameterDeclarations());
  getTemplateSummaryResult.getParameters().setMember(template.getParameterDeclarations());
  getTemplateSummaryResult.setMetadata(template.getMetadataJSON());
  return getTemplateSummaryResult;
}