Program: 99269
Project: 99269
Buggy source:
/** 
 * build rewrite rule set from textual description in   {@code p}. rule set is a collection of a sub-tree for each element, stored in   {@code rules}Map.   {@code rules} maps tag name to a tree of {@code TransformAttr}.   {@code TransformAttr}tree is in essence a linked list of   {@code TransformAttr} grouped by attribute name. In eachgroup,  {@code TransformAttr}s are sorted by their <em>specificity</em>. Within the same specificity, the   {@code TransformAttr} added last comes on top (so that rules added through{@configProperties} override default rules.). As the order of keys in a single {@code Properties}is unspecified, there's no guarantee later line overrides former lines with the same key.
 * @param p Properties with rewrite rules.
 */
protected void loadRulesFromProperties(Properties p){
  for (  String key : p.stringPropertyNames()) {
    Matcher m=RE_TAG_ATTR_TYPE.matcher(key);
    if (m.matches()) {
      String tagName=m.group(1);
      String testAttrName=m.group(2);
      String testAttrValue=m.group(3);
      String attrNameMatch=m.group(4);
      String transformerName=p.getProperty(key);
      StringTransformer transformer=transformers.get(transformerName);
      if (transformer == null) {
        LOGGER.warning("String_Node_Str" + transformerName + "String_Node_Str"+ key+ "String_Node_Str");
        continue;
      }
      TransformAttr t;
      if (testAttrName != null) {
        t=new TransformAttrIfAttrValue(attrNameMatch,transformer,testAttrName,testAttrValue);
      }
 else {
        t=new TransformAttr(attrNameMatch,transformer);
      }
      TransformAttr ta=rules.get(tagName);
      TransformAttr pta=null;
      while (true) {
        if (ta == null) {
          if (pta == null) {
            rules.put(tagName,t);
          }
 else {
            pta.next=t;
          }
          break;
        }
        if (ta.attrName.equals(t.attrName)) {
          TransformAttr palt=null;
          while (true) {
            if (t.compareTo(ta) >= 0) {
              t.alt=ta;
              t.next=ta.next;
              ta.next=null;
              if (palt == null) {
                if (pta == null) {
                  rules.put(tagName,t);
                }
 else {
                  pta.next=t;
                }
              }
 else {
                palt.next=t;
              }
              break;
            }
            palt=ta;
            ta=ta.alt;
            if (ta == null) {
              palt.alt=t;
              break;
            }
          }
          break;
        }
        pta=ta;
        ta=ta.next;
      }
      continue;
    }
    LOGGER.warning("String_Node_Str" + key + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * build rewrite rule set from textual description in   {@code p}. rule set is a collection of a sub-tree for each element, stored in   {@code rules}Map.   {@code rules} maps tag name to a tree of {@code TransformAttr}.   {@code TransformAttr}tree is in essence a linked list of   {@code TransformAttr} grouped by attribute name. In eachgroup,  {@code TransformAttr}s are sorted by their <em>specificity</em>. Within the same specificity, the   {@code TransformAttr} added last comes on top (so that rules added through{@code Properties} override default rules.). As the order of keys in a single {@code Properties}is unspecified, there's no guarantee later line overrides former lines with the same key.
 * @param p Properties with rewrite rules.
 */
protected void loadRulesFromProperties(Properties p){
  for (  String key : p.stringPropertyNames()) {
    Matcher m=RE_TAG_ATTR_TYPE.matcher(key);
    if (m.matches()) {
      String tagName=m.group(1);
      String testAttrName=m.group(2);
      String testAttrValue=m.group(3);
      String attrNameMatch=m.group(4);
      String transformerName=p.getProperty(key);
      StringTransformer transformer=transformers.get(transformerName);
      if (transformer == null) {
        LOGGER.warning("String_Node_Str" + transformerName + "String_Node_Str"+ key+ "String_Node_Str");
        continue;
      }
      TransformAttr t;
      if (testAttrName != null) {
        t=new TransformAttrIfAttrValue(attrNameMatch,transformer,testAttrName,testAttrValue);
      }
 else {
        t=new TransformAttr(attrNameMatch,transformer);
      }
      TransformAttr ta=rules.get(tagName);
      TransformAttr pta=null;
      while (true) {
        if (ta == null) {
          if (pta == null) {
            rules.put(tagName,t);
          }
 else {
            pta.next=t;
          }
          break;
        }
        if (ta.attrName.equals(t.attrName)) {
          TransformAttr palt=null;
          while (true) {
            if (t.compareTo(ta) >= 0) {
              t.alt=ta;
              t.next=ta.next;
              ta.next=null;
              if (palt == null) {
                if (pta == null) {
                  rules.put(tagName,t);
                }
 else {
                  pta.next=t;
                }
              }
 else {
                palt.next=t;
              }
              break;
            }
            palt=ta;
            ta=ta.alt;
            if (ta == null) {
              palt.alt=t;
              break;
            }
          }
          break;
        }
        pta=ta;
        ta=ta.next;
      }
      continue;
    }
    LOGGER.warning("String_Node_Str" + key + "String_Node_Str");
  }
}