Program: 110825
Project: 110825
Buggy source:
@Override public void recordResourceReferences(ResourceFolderType folderType,Node node,Resource from){
  super.recordResourceReferences(folderType,node,from);
  if (from != null && node.getNodeType() == Node.ELEMENT_NODE) {
    NamedNodeMap attributes=((Element)node).getAttributes();
    for (int i=0; i < attributes.getLength(); i++) {
      Attr attr=(Attr)attributes.item(i);
      if (attr.getValue().startsWith(SdkConstants.PREFIX_RESOURCE_REF) && SdkConstants.ATTR_ID.equals(attr.getLocalName()) && SdkConstants.ANDROID_URI.equals(attr.getNamespaceURI())) {
        ResourceUrl url=ResourceUrl.parse(attr.getValue());
        if (url != null) {
          Resource resource=getResource(url.type,url.name);
          if (resource != null) {
            from.addReference(resource);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Records resource declarations and usages within an XML resource file
 * @param folderType the type of resource file
 * @param node the root node to start the recursive search from
 * @param from a referencing context, if any.
 */
@Override public void recordResourceReferences(@NonNull ResourceFolderType folderType,@NonNull Node node,@Nullable Resource from){
  short nodeType=node.getNodeType();
  if (nodeType == Node.ELEMENT_NODE) {
    Element element=(Element)node;
    if (from != null) {
      NamedNodeMap attributes=element.getAttributes();
      for (int i=0, n=attributes.getLength(); i < n; i++) {
        Attr attr=(Attr)attributes.item(i);
        if (TOOLS_URI.equals(attr.getNamespaceURI())) {
          recordToolsAttributes(attr);
          continue;
        }
        String value=attr.getValue();
        if (!(value.startsWith(PREFIX_RESOURCE_REF) || value.startsWith(PREFIX_THEME_REF))) {
          continue;
        }
        ResourceUrl url=ResourceUrl.parse(value);
        if (url != null && !url.framework) {
          Resource resource;
          if (url.create) {
            resource=declareResource(url.type,url.name,attr);
            from.addReference(resource);
          }
 else {
            resource=addResource(url.type,url.name,null);
            from.addReference(resource);
          }
        }
 else         if (value.startsWith("String_Node_Str")) {
          int length=value.length();
          int index=2;
          while (true) {
            index=value.indexOf('@',index);
            if (index == -1) {
              break;
            }
            int end=index + 1;
            while (end < length) {
              char c=value.charAt(end);
              if (!(Character.isJavaIdentifierPart(c) || c == '_' || c == '.' || c == '/' || c == '+')) {
                break;
              }
              end++;
            }
            url=ResourceUrl.parse(value.substring(index,end));
            if (url != null && !url.framework) {
              Resource resource;
              if (url.create) {
                resource=declareResource(url.type,url.name,attr);
              }
 else {
                resource=addResource(url.type,url.name,null);
              }
              from.addReference(resource);
            }
            index=end;
          }
        }
      }
      if ("String_Node_Str".equals(element.getTagName())) {
        StringBuilder sb=new StringBuilder();
        NodeList children=node.getChildNodes();
        for (int i=0, n=children.getLength(); i < n; i++) {
          Node child=children.item(i);
          if (child.getNodeType() == Element.TEXT_NODE || child.getNodeType() == Element.CDATA_SECTION_NODE) {
            sb.append(child.getNodeValue());
          }
        }
        if (sb.length() > 0) {
          Resource resource=getResource(ResourceType.RAW,sb.toString().trim());
          from.addReference(resource);
        }
      }
    }
 else {
      recordToolsAttributes(element.getAttributeNodeNS(TOOLS_URI,ATTR_KEEP));
      recordToolsAttributes(element.getAttributeNodeNS(TOOLS_URI,ATTR_DISCARD));
      recordToolsAttributes(element.getAttributeNodeNS(TOOLS_URI,ATTR_SHRINK_MODE));
    }
    if (folderType == ResourceFolderType.VALUES) {
      Resource definition=null;
      ResourceType type=getResourceType(element);
      if (type != null) {
        String name=getFieldName(element);
        if (type == ResourceType.PUBLIC) {
          String typeName=element.getAttribute(ATTR_TYPE);
          if (!typeName.isEmpty()) {
            type=ResourceType.getEnum(typeName);
            if (type != null) {
              definition=declareResource(type,name,element);
              definition.setPublic(true);
            }
          }
        }
 else {
          definition=declareResource(type,name,element);
        }
      }
      if (definition != null) {
        from=definition;
      }
      String tagName=element.getTagName();
      if (TAG_STYLE.equals(tagName)) {
        if (element.hasAttribute(ATTR_PARENT)) {
          String parent=element.getAttribute(ATTR_PARENT);
          if (parent.startsWith(ANDROID_STYLE_RESOURCE_PREFIX) || parent.startsWith(PREFIX_ANDROID)) {
            if (definition != null) {
              markReachable(definition);
            }
          }
 else           if (!parent.isEmpty()) {
            String parentStyle=parent;
            if (!parentStyle.startsWith(STYLE_RESOURCE_PREFIX)) {
              parentStyle=STYLE_RESOURCE_PREFIX + parentStyle;
            }
            Resource ps=getResourceFromUrl(LintUtils.getFieldName(parentStyle));
            if (ps != null && definition != null) {
              definition.addReference(ps);
            }
          }
        }
 else {
          String name=getFieldName(element);
          while (true) {
            int index=name.lastIndexOf('_');
            if (index != -1) {
              name=name.substring(0,index);
              Resource ps=getResourceFromUrl(STYLE_RESOURCE_PREFIX + LintUtils.getFieldName(name));
              if (ps != null && definition != null) {
                definition.addReference(ps);
              }
            }
 else {
              break;
            }
          }
        }
      }
      if (TAG_ITEM.equals(tagName)) {
        if (element.getParentNode() != null && element.getParentNode().getNodeName().equals(TAG_STYLE)) {
          String name=element.getAttributeNS(ANDROID_URI,ATTR_NAME);
          if (!name.isEmpty() && !name.startsWith("String_Node_Str")) {
            Resource resource=getResource(ResourceType.ATTR,name);
            if (definition == null) {
              Element style=(Element)element.getParentNode();
              definition=getResource(style);
              if (definition != null) {
                from=definition;
                definition.addReference(resource);
              }
            }
          }
        }
      }
    }
  }
 else   if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) {
    String text=node.getNodeValue().trim();
    Resource textResource=getResourceFromUrl(LintUtils.getFieldName(text));
    if (textResource != null && from != null) {
      from.addReference(textResource);
    }
  }
  NodeList children=node.getChildNodes();
  for (int i=0, n=children.getLength(); i < n; i++) {
    Node child=children.item(i);
    recordResourceReferences(folderType,child,from);
  }
}