Program: 13493
Project: 13493
Buggy source:
/** 
 * @param bos
 * @param member
 * @param newMembers
 * @throws BosException 
 * @throws DitaApiException 
 */
protected void findLinkDependencies(BoundedObjectSet bos,XmlBosMember member,Set<BosMember> newMembers) throws BosException, DitaApiException {
  NodeList links;
  try {
    links=(NodeList)DitaUtil.allHrefsAndKeyrefs.evaluate(member.getElement(),XPathConstants.NODESET);
  }
 catch (  XPathExpressionException e) {
    throw new BosException("String_Node_Str" + DitaUtil.allTopicrefs);
  }
  log.debug("String_Node_Str" + links.getLength() + "String_Node_Str");
  for (int i=0; i < links.getLength(); i++) {
    Element link=(Element)links.item(i);
    Document targetDoc=null;
    URI targetUri=null;
    String href=null;
    DependencyType depType=Constants.LINK_DEPENDENCY;
    try {
      if (link.hasAttribute("String_Node_Str")) {
        log.debug("String_Node_Str" + link.getAttribute("String_Node_Str") + "String_Node_Str");
        if (!DitaUtil.targetIsADitaFormat(link) || DitaUtil.isDitaType(link,"String_Node_Str")) {
          targetUri=resolveKeyrefToUri(link.getAttribute("String_Node_Str"));
        }
 else {
          targetDoc=resolveKeyrefToDoc(link.getAttribute("String_Node_Str"));
        }
      }
      if (targetUri == null && targetDoc == null && link.hasAttribute("String_Node_Str")) {
        log.debug("String_Node_Str" + link.getAttribute("String_Node_Str") + "String_Node_Str");
        href=link.getAttribute("String_Node_Str");
        if (DitaUtil.isDitaType(link,"String_Node_Str")) {
          targetUri=AddressingUtil.resolveHrefToUri(link,link.getAttribute("String_Node_Str"),this.failOnAddressResolutionFailure);
          depType=Constants.IMAGE_DEPENDENCY;
        }
 else         if (!DitaUtil.targetIsADitaFormat(link) && DitaUtil.isLocalOrPeerScope(link)) {
          targetUri=AddressingUtil.resolveHrefToUri(link,link.getAttribute("String_Node_Str"),this.failOnAddressResolutionFailure);
        }
 else {
          if (!href.startsWith("String_Node_Str") && DitaUtil.isLocalOrPeerScope(link)) {
            targetDoc=AddressingUtil.resolveHrefToDoc(link,link.getAttribute("String_Node_Str"),bosConstructionOptions,this.failOnAddressResolutionFailure);
          }
          if (DitaUtil.isDitaType(link,"String_Node_Str")) {
            depType=Constants.XREF_DEPENDENCY;
          }
 else           if (DitaUtil.isDitaType(link,"String_Node_Str")) {
            depType=Constants.LINK_DEPENDENCY;
          }
        }
      }
    }
 catch (    AddressingException e) {
      if (this.failOnAddressResolutionFailure) {
        throw new BosException("String_Node_Str" + link.getAttribute("String_Node_Str") + "String_Node_Str",e);
      }
    }
    if (targetDoc == null && targetUri == null || targetDoc == member.getDocument())     continue;
    BosMember childMember=null;
    if (targetDoc != null) {
      log.debug("String_Node_Str" + targetDoc.getDocumentURI() + "String_Node_Str");
      childMember=bos.constructBosMember(member,targetDoc);
    }
 else     if (targetUri != null) {
      log.debug("String_Node_Str" + targetUri.toString() + "String_Node_Str");
      childMember=bos.constructBosMember((BosMember)member,targetUri);
    }
    newMembers.add(childMember);
    member.registerDependency(href,childMember,depType);
  }
}

Fixed version (ground truth):
/** 
 * @param bos
 * @param member
 * @param newMembers
 * @throws BosException 
 * @throws DitaApiException 
 */
protected void findLinkDependencies(BoundedObjectSet bos,XmlBosMember member,Set<BosMember> newMembers) throws BosException, DitaApiException {
  NodeList links;
  try {
    links=(NodeList)DitaUtil.allHrefsAndKeyrefs.evaluate(member.getElement(),XPathConstants.NODESET);
  }
 catch (  XPathExpressionException e) {
    throw new BosException("String_Node_Str" + DitaUtil.allTopicrefs);
  }
  log.debug("String_Node_Str" + links.getLength() + "String_Node_Str");
  for (int i=0; i < links.getLength(); i++) {
    Element link=(Element)links.item(i);
    Document targetDoc=null;
    URI targetUri=null;
    String dependencyKey=null;
    String href=null;
    DependencyType depType=Constants.LINK_DEPENDENCY;
    if (DitaUtil.isDitaType(link,"String_Node_Str")) {
      depType=Constants.IMAGE_DEPENDENCY;
    }
 else     if (DitaUtil.isDitaType(link,"String_Node_Str")) {
      depType=Constants.XREF_DEPENDENCY;
    }
    try {
      if (link.hasAttribute("String_Node_Str")) {
        log.debug("String_Node_Str" + link.getAttribute("String_Node_Str") + "String_Node_Str");
        if (!DitaUtil.targetIsADitaFormat(link) || DitaUtil.isDitaType(link,"String_Node_Str")) {
          targetUri=resolveKeyrefToUri(link.getAttribute("String_Node_Str"));
        }
 else {
          targetDoc=resolveKeyrefToDoc(link.getAttribute("String_Node_Str"));
        }
      }
      if (targetUri == null && targetDoc == null && link.hasAttribute("String_Node_Str")) {
        log.debug("String_Node_Str" + link.getAttribute("String_Node_Str") + "String_Node_Str");
        href=link.getAttribute("String_Node_Str");
        dependencyKey=href;
        if (DitaUtil.isDitaType(link,"String_Node_Str")) {
          targetUri=AddressingUtil.resolveHrefToUri(link,link.getAttribute("String_Node_Str"),this.failOnAddressResolutionFailure);
        }
 else         if (!DitaUtil.targetIsADitaFormat(link) && DitaUtil.isLocalOrPeerScope(link)) {
          targetUri=AddressingUtil.resolveHrefToUri(link,link.getAttribute("String_Node_Str"),this.failOnAddressResolutionFailure);
        }
 else {
          if (!href.startsWith("String_Node_Str") && DitaUtil.isLocalOrPeerScope(link)) {
            targetDoc=AddressingUtil.resolveHrefToDoc(link,link.getAttribute("String_Node_Str"),bosConstructionOptions,this.failOnAddressResolutionFailure);
          }
        }
      }
 else {
        dependencyKey=AddressingUtil.getKeyNameFromKeyref(link);
      }
    }
 catch (    AddressingException e) {
      if (this.failOnAddressResolutionFailure) {
        throw new BosException("String_Node_Str" + link.getAttribute("String_Node_Str") + "String_Node_Str",e);
      }
    }
    if (targetDoc == null && targetUri == null || targetDoc == member.getDocument())     continue;
    BosMember childMember=null;
    if (targetDoc != null) {
      log.debug("String_Node_Str" + targetDoc.getDocumentURI() + "String_Node_Str");
      childMember=bos.constructBosMember(member,targetDoc);
    }
 else     if (targetUri != null) {
      log.debug("String_Node_Str" + targetUri.toString() + "String_Node_Str");
      childMember=bos.constructBosMember((BosMember)member,targetUri);
    }
    newMembers.add(childMember);
    member.registerDependency(dependencyKey,childMember,depType);
  }
}