Program: 14205
Project: 14205
Buggy source:
private void resourceDependencyCrawl(String resourceKey,JsonNode jsonNode,DependencyManager resourceDependencies,Template template,Set<String> unresolvedResourceDependencies,boolean onLiveBranch) throws CloudFormationException {
  Map<String,String> pseudoParameterMap=StackEntityHelper.jsonToPseudoParameterMap(template.getStackEntity().getPseudoParameterMapJson());
  Map<String,StackEntity.Parameter> parameterMap=StackEntityHelper.jsonToParameterMap(template.getStackEntity().getParametersJson());
  if (jsonNode == null) {
    return;
  }
  if (jsonNode.isArray()) {
    for (int i=0; i < jsonNode.size(); i++) {
      resourceDependencyCrawl(resourceKey,jsonNode.get(i),resourceDependencies,template,unresolvedResourceDependencies,onLiveBranch);
    }
  }
  IntrinsicFunction.MatchResult fnIfMatcher=IntrinsicFunctions.IF.evaluateMatch(jsonNode);
  if (fnIfMatcher.isMatch()) {
    IntrinsicFunctions.IF.validateArgTypesWherePossible(fnIfMatcher);
    JsonNode keyJsonNode=jsonNode.get(FunctionEvaluation.FN_IF);
    String key=keyJsonNode.get(0).textValue();
    Map<String,Boolean> conditionMap=StackEntityHelper.jsonToConditionMap(template.getStackEntity().getConditionMapJson());
    if (!conditionMap.containsKey(key)) {
      throw new ValidationErrorException("String_Node_Str" + key);
    }
    ;
    boolean booleanValue=StackEntityHelper.jsonToConditionMap(template.getStackEntity().getConditionMapJson()).get(key);
    resourceDependencyCrawl(resourceKey,keyJsonNode.get(1),resourceDependencies,template,unresolvedResourceDependencies,onLiveBranch && booleanValue);
    resourceDependencyCrawl(resourceKey,keyJsonNode.get(2),resourceDependencies,template,unresolvedResourceDependencies,onLiveBranch && (!booleanValue));
    return;
  }
  IntrinsicFunction.MatchResult refMatcher=IntrinsicFunctions.REF.evaluateMatch(jsonNode);
  if (refMatcher.isMatch()) {
    IntrinsicFunctions.REF.validateArgTypesWherePossible(refMatcher);
    String refName=jsonNode.get(FunctionEvaluation.REF_STR).textValue();
    if (template.getResourceInfoMap().containsKey(refName)) {
      if (onLiveBranch) {
        resourceDependencies.addDependency(resourceKey,refName);
      }
    }
 else     if (!parameterMap.containsKey(refName) && !pseudoParameterMap.containsKey(refName)) {
      unresolvedResourceDependencies.add(refName);
    }
    return;
  }
  IntrinsicFunction.MatchResult fnAttMatcher=IntrinsicFunctions.GET_ATT.evaluateMatch(jsonNode);
  if (fnAttMatcher.isMatch()) {
    IntrinsicFunctions.GET_ATT.validateArgTypesWherePossible(refMatcher);
    String refName=jsonNode.get(FunctionEvaluation.FN_GET_ATT).get(0).textValue();
    String attName=jsonNode.get(FunctionEvaluation.FN_GET_ATT).get(1).textValue();
    if (template.getResourceInfoMap().containsKey(refName)) {
      ResourceInfo resourceInfo=template.getResourceInfoMap().get(refName);
      if (resourceInfo.canCheckAttributes() && !ResourceAttributeResolver.resourceHasAttribute(resourceInfo,attName)) {
        throw new ValidationErrorException("String_Node_Str" + refName + "String_Node_Str"+ attName+ "String_Node_Str");
      }
 else {
        if (onLiveBranch) {
          resourceDependencies.addDependency(resourceKey,refName);
        }
      }
    }
 else {
      throw new ValidationErrorException("String_Node_Str" + refName);
    }
    return;
  }
  List<String> fieldNames=Lists.newArrayList(jsonNode.fieldNames());
  for (  String fieldName : fieldNames) {
    resourceDependencyCrawl(resourceKey,jsonNode.get(fieldName),resourceDependencies,template,unresolvedResourceDependencies,onLiveBranch);
  }
}

Fixed version (ground truth):
private void resourceDependencyCrawl(String resourceKey,JsonNode jsonNode,DependencyManager resourceDependencies,Template template,Set<String> unresolvedResourceDependencies,boolean onLiveBranch) throws CloudFormationException {
  Map<String,String> pseudoParameterMap=StackEntityHelper.jsonToPseudoParameterMap(template.getStackEntity().getPseudoParameterMapJson());
  Map<String,StackEntity.Parameter> parameterMap=StackEntityHelper.jsonToParameterMap(template.getStackEntity().getParametersJson());
  if (jsonNode == null) {
    return;
  }
  if (jsonNode.isArray()) {
    for (int i=0; i < jsonNode.size(); i++) {
      resourceDependencyCrawl(resourceKey,jsonNode.get(i),resourceDependencies,template,unresolvedResourceDependencies,onLiveBranch);
    }
  }
  IntrinsicFunction.MatchResult fnIfMatcher=IntrinsicFunctions.IF.evaluateMatch(jsonNode);
  if (fnIfMatcher.isMatch()) {
    IntrinsicFunctions.IF.validateArgTypesWherePossible(fnIfMatcher);
    JsonNode keyJsonNode=jsonNode.get(FunctionEvaluation.FN_IF);
    String key=keyJsonNode.get(0).textValue();
    Map<String,Boolean> conditionMap=StackEntityHelper.jsonToConditionMap(template.getStackEntity().getConditionMapJson());
    if (!conditionMap.containsKey(key)) {
      throw new ValidationErrorException("String_Node_Str" + key);
    }
    ;
    boolean booleanValue=StackEntityHelper.jsonToConditionMap(template.getStackEntity().getConditionMapJson()).get(key);
    resourceDependencyCrawl(resourceKey,keyJsonNode.get(1),resourceDependencies,template,unresolvedResourceDependencies,onLiveBranch && booleanValue);
    resourceDependencyCrawl(resourceKey,keyJsonNode.get(2),resourceDependencies,template,unresolvedResourceDependencies,onLiveBranch && (!booleanValue));
    return;
  }
  IntrinsicFunction.MatchResult refMatcher=IntrinsicFunctions.REF.evaluateMatch(jsonNode);
  if (refMatcher.isMatch()) {
    IntrinsicFunctions.REF.validateArgTypesWherePossible(refMatcher);
    String refName=jsonNode.get(FunctionEvaluation.REF_STR).textValue();
    if (template.getResourceInfoMap().containsKey(refName)) {
      if (onLiveBranch) {
        resourceDependencies.addDependency(resourceKey,refName);
      }
    }
 else     if (!parameterMap.containsKey(refName) && !pseudoParameterMap.containsKey(refName)) {
      unresolvedResourceDependencies.add(refName);
    }
    return;
  }
  IntrinsicFunction.MatchResult fnAttMatcher=IntrinsicFunctions.GET_ATT.evaluateMatch(jsonNode);
  if (fnAttMatcher.isMatch()) {
    IntrinsicFunctions.GET_ATT.validateArgTypesWherePossible(fnAttMatcher);
    String refName=jsonNode.get(FunctionEvaluation.FN_GET_ATT).get(0).textValue();
    String attName=jsonNode.get(FunctionEvaluation.FN_GET_ATT).get(1).textValue();
    if (template.getResourceInfoMap().containsKey(refName)) {
      ResourceInfo resourceInfo=template.getResourceInfoMap().get(refName);
      if (resourceInfo.canCheckAttributes() && !ResourceAttributeResolver.resourceHasAttribute(resourceInfo,attName)) {
        throw new ValidationErrorException("String_Node_Str" + refName + "String_Node_Str"+ attName+ "String_Node_Str");
      }
 else {
        if (onLiveBranch) {
          resourceDependencies.addDependency(resourceKey,refName);
        }
      }
    }
 else {
      throw new ValidationErrorException("String_Node_Str" + refName);
    }
    return;
  }
  List<String> fieldNames=Lists.newArrayList(jsonNode.fieldNames());
  for (  String fieldName : fieldNames) {
    resourceDependencyCrawl(resourceKey,jsonNode.get(fieldName),resourceDependencies,template,unresolvedResourceDependencies,onLiveBranch);
  }
}