Program: 60324
Project: 60324
Buggy source:
protected Object _resolveTagValue(String tagName,int depth,boolean ignoreParentContext){
  if (isInvalidTag(tagName))   return null;
  if (tagName.indexOf('`') > -1) {
    tagName=resolveBackticks(tagName,depth);
  }
  String lookupName=tagName;
  int colonPos=tagName.indexOf(':');
  int pipePos=tagName.indexOf('|');
  if (pipePos > -1)   pipePos=confirmPipe(tagName,pipePos);
  if (colonPos > 0 || pipePos > 0) {
    int firstMod=(colonPos > 0) ? colonPos : pipePos;
    if (pipePos > 0 && pipePos < colonPos)     firstMod=pipePos;
    lookupName=tagName.substring(0,firstMod);
  }
  Object tagValue=null;
  if (lookupName.charAt(0) == '.') {
    tagValue=altFetch(tagName,depth);
  }
 else   if (hasValue(lookupName)) {
    tagValue=getTag(lookupName);
  }
 else {
    Vector<Chunk> parentContext=getCurrentParentContext();
    if (parentContext != null) {
      for (      Chunk ancestor : parentContext) {
        tagValue=ancestor._resolveTagValue(lookupName,depth,true);
        if (tagValue != null)         break;
      }
    }
  }
  if (tagValue != null) {
    if (pipePos > 0) {
      Chunk filterMeLater=makeChildChunk();
      String filter=parseTagTokens(tagName,pipePos,colonPos)[0];
      String[] filters=TextFilter.splitFilters(filter);
      filterMeLater.set("String_Node_Str",tagValue,filter);
      filterMeLater.append("String_Node_Str");
      filterMeLater.delayedFilter=filters[0];
      return makeFilterOnion(tagValue,filterMeLater,filters);
    }
 else {
      return tagValue;
    }
  }
  if (colonPos > 0) {
    String defValue=null;
    String filter=null;
    String order=TextFilter.FILTER_LAST;
    if (pipePos > 0) {
      String[] tokens=parseTagTokens(tagName,pipePos,colonPos);
      filter=tokens[0];
      defValue=tokens[1];
      order=tokens[2];
    }
 else {
      defValue=tagName.substring(colonPos + 1);
    }
    if (defValue != null && defValue.length() > 0) {
      char firstChar=defValue.charAt(0);
      if (firstChar == '~' || firstChar == '+' || firstChar == '^') {
        if (filter == null) {
          return '{' + defValue + '}';
        }
 else         if (order.equals(TextFilter.FILTER_FIRST)) {
          String filtered=TextFilter.applyTextFilter(this,filter,null);
          if (filtered != null) {
            return filtered;
          }
 else {
            return '{' + defValue + '}';
          }
        }
 else {
          return '{' + defValue + '|'+ filter+ '}';
        }
      }
    }
    if (filter != null) {
      if (order.equals(TextFilter.FILTER_FIRST)) {
        String filtered=TextFilter.applyTextFilter(this,filter,null);
        return (filtered != null) ? filtered : defValue;
      }
 else {
        return TextFilter.applyTextFilter(this,filter,defValue);
      }
    }
 else {
      return defValue;
    }
  }
 else {
    if (pipePos > 0) {
      String filter=tagName.substring(pipePos + 1);
      return TextFilter.applyTextFilter(this,filter,null);
    }
 else {
      return null;
    }
  }
}

Fixed version (ground truth):
protected Object _resolveTagValue(String tagName,int depth,boolean ignoreParentContext){
  if (isInvalidTag(tagName))   return null;
  if (tagName.indexOf('`') > -1) {
    tagName=resolveBackticks(tagName,depth);
  }
  String lookupName=tagName;
  int colonPos=tagName.indexOf(':');
  int pipePos=tagName.indexOf('|');
  if (pipePos > -1)   pipePos=confirmPipe(tagName,pipePos);
  if (colonPos > 0 || pipePos > 0) {
    int firstMod=(colonPos > 0) ? colonPos : pipePos;
    if (pipePos > 0 && pipePos < colonPos)     firstMod=pipePos;
    lookupName=tagName.substring(0,firstMod);
  }
  Object tagValue=null;
  if (lookupName.charAt(0) == '.') {
    tagValue=altFetch(tagName,depth);
  }
 else   if (hasValue(lookupName)) {
    tagValue=getTag(lookupName);
  }
 else {
    Vector<Chunk> parentContext=getCurrentParentContext();
    if (parentContext != null) {
      for (      Chunk ancestor : parentContext) {
        tagValue=ancestor._resolveTagValue(lookupName,depth,true);
        if (tagValue != null)         break;
      }
    }
  }
  if (tagValue != null) {
    if (pipePos > 0) {
      Chunk filterMeLater=makeChildChunk();
      String filter=parseTagTokens(tagName,pipePos,colonPos)[0];
      String[] filters=TextFilter.splitFilters(filter);
      filterMeLater.set("String_Node_Str",tagValue,filter);
      filterMeLater.append("String_Node_Str");
      filterMeLater.delayedFilter=filters[0];
      return makeFilterOnion(tagValue,filterMeLater,filters);
    }
 else {
      return tagValue;
    }
  }
  if (colonPos > 0) {
    String defValue=null;
    String filter=null;
    String order=TextFilter.FILTER_LAST;
    if (pipePos > 0) {
      String[] tokens=parseTagTokens(tagName,pipePos,colonPos);
      filter=tokens[0];
      defValue=tokens[1];
      order=tokens[2];
    }
 else {
      defValue=tagName.substring(colonPos + 1);
    }
    if (defValue != null && defValue.length() > 0) {
      char firstChar=defValue.charAt(0);
      if (firstChar == '~' || firstChar == '$' || firstChar == '+' || firstChar == '^' || firstChar == '.') {
        if (filter == null) {
          return '{' + defValue + '}';
        }
 else         if (order.equals(TextFilter.FILTER_FIRST)) {
          String filtered=TextFilter.applyTextFilter(this,filter,null);
          if (filtered != null) {
            return filtered;
          }
 else {
            return '{' + defValue + '}';
          }
        }
 else {
          return '{' + defValue + '|'+ filter+ '}';
        }
      }
    }
    if (filter != null) {
      if (order.equals(TextFilter.FILTER_FIRST)) {
        String filtered=TextFilter.applyTextFilter(this,filter,null);
        return (filtered != null) ? filtered : defValue;
      }
 else {
        return TextFilter.applyTextFilter(this,filter,defValue);
      }
    }
 else {
      return defValue;
    }
  }
 else {
    if (pipePos > 0) {
      String filter=tagName.substring(pipePos + 1);
      return TextFilter.applyTextFilter(this,filter,null);
    }
 else {
      return null;
    }
  }
}