Program: 13000
Project: 13000
Buggy source:
/** 
 * Create derived components found in the switchyard.xml.
 * @param derivedArtifacts
 * @param artifact
 * @param rootElement
 * @param xpath
 */
private void processComponents(Collection<BaseArtifactType> derivedArtifacts,BaseArtifactType artifact,Element rootElement,XPath xpath) throws XPathExpressionException {
  NodeList nodes=(NodeList)this.query(xpath,rootElement,"String_Node_Str",XPathConstants.NODESET);
  for (int idx=0; idx < nodes.getLength(); idx++) {
    Element node=(Element)nodes.item(idx);
    String name=node.getAttribute("String_Node_Str");
    ExtendedArtifactType componentArtifact=SwitchYardModel.newComponentArtifact(name);
    derivedArtifacts.add(componentArtifact);
    Element implBean=(Element)this.query(xpath,node,"String_Node_Str",XPathConstants.NODE);
    if (implBean != null) {
      if (implBean.hasAttribute("String_Node_Str")) {
        String implClassName=implBean.getAttribute("String_Node_Str");
        Relationship relationship=SrampModelUtils.addGenericRelationship(componentArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
        relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + implClassName);
      }
      if (implBean.hasAttribute("String_Node_Str")) {
        String requires=implBean.getAttribute("String_Node_Str");
        SrampModelUtils.setCustomProperty(componentArtifact,"String_Node_Str",requires);
      }
    }
    Element implCamel=(Element)this.query(xpath,node,"String_Node_Str",XPathConstants.NODE);
    if (implCamel != null) {
      Element xml=(Element)this.query(xpath,implCamel,"String_Node_Str",XPathConstants.NODE);
      if (xml != null) {
        String path=xml.getAttribute("String_Node_Str");
        Relationship relationship=SrampModelUtils.addGenericRelationship(componentArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
        relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + path);
      }
      if (implCamel.hasAttribute("String_Node_Str")) {
        String requires=implCamel.getAttribute("String_Node_Str");
        SrampModelUtils.setCustomProperty(componentArtifact,"String_Node_Str",requires);
      }
    }
    NodeList refs=(NodeList)this.query(xpath,node,"String_Node_Str",XPathConstants.NODESET);
    for (int jdx=0; jdx < refs.getLength(); jdx++) {
      Element ref=(Element)refs.item(jdx);
      Element iface=(Element)this.query(xpath,ref,"String_Node_Str",XPathConstants.NODE);
      if (iface != null) {
        if (iface.hasAttribute("String_Node_Str")) {
          String ifaceName=iface.getAttribute("String_Node_Str");
          Relationship relationship=SrampModelUtils.addGenericRelationship(componentArtifact,SwitchYardModel.REL_REFERENCES,null);
          relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + ifaceName);
        }
      }
      iface=(Element)this.query(xpath,ref,"String_Node_Str",XPathConstants.NODE);
      if (iface != null) {
        if (iface.hasAttribute("String_Node_Str")) {
          String wsdlInfo=iface.getAttribute("String_Node_Str");
          Relationship relationship=SrampModelUtils.addGenericRelationship(componentArtifact,SwitchYardModel.REL_REFERENCES,null);
          relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + wsdlInfo);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Create derived components found in the switchyard.xml.
 * @param derivedArtifacts
 * @param artifact
 * @param rootElement
 * @param xpath
 */
private void processComponents(Collection<BaseArtifactType> derivedArtifacts,BaseArtifactType artifact,Element rootElement,XPath xpath) throws XPathExpressionException {
  NodeList nodes=(NodeList)this.query(xpath,rootElement,"String_Node_Str",XPathConstants.NODESET);
  for (int idx=0; idx < nodes.getLength(); idx++) {
    Element node=(Element)nodes.item(idx);
    String name=node.getAttribute("String_Node_Str");
    ExtendedArtifactType componentArtifact=SwitchYardModel.newComponentArtifact(name);
    derivedArtifacts.add(componentArtifact);
    Element implBean=(Element)this.query(xpath,node,"String_Node_Str",XPathConstants.NODE);
    if (implBean != null) {
      if (implBean.hasAttribute("String_Node_Str")) {
        String implClassName=implBean.getAttribute("String_Node_Str");
        Relationship relationship=SrampModelUtils.addGenericRelationship(componentArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
        relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + implClassName);
      }
      if (implBean.hasAttribute("String_Node_Str")) {
        String requires=implBean.getAttribute("String_Node_Str");
        SrampModelUtils.setCustomProperty(componentArtifact,"String_Node_Str",requires);
      }
    }
    Element implCamel=(Element)this.query(xpath,node,"String_Node_Str",XPathConstants.NODE);
    if (implCamel != null) {
      Element xml=(Element)this.query(xpath,implCamel,"String_Node_Str",XPathConstants.NODE);
      if (xml != null) {
        String path=xml.getAttribute("String_Node_Str");
        Relationship relationship=SrampModelUtils.addGenericRelationship(componentArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
        relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + path);
      }
      if (implCamel.hasAttribute("String_Node_Str")) {
        String requires=implCamel.getAttribute("String_Node_Str");
        SrampModelUtils.setCustomProperty(componentArtifact,"String_Node_Str",requires);
      }
    }
    NodeList refs=(NodeList)this.query(xpath,node,"String_Node_Str",XPathConstants.NODESET);
    for (int jdx=0; jdx < refs.getLength(); jdx++) {
      Element ref=(Element)refs.item(jdx);
      Element iface=(Element)this.query(xpath,ref,"String_Node_Str",XPathConstants.NODE);
      if (iface != null) {
        if (iface.hasAttribute("String_Node_Str")) {
          String ifaceName=iface.getAttribute("String_Node_Str");
          Relationship relationship=SrampModelUtils.addGenericRelationship(componentArtifact,SwitchYardModel.REL_REFERENCES,null);
          relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + ifaceName);
        }
      }
      iface=(Element)this.query(xpath,ref,"String_Node_Str",XPathConstants.NODE);
      if (iface != null) {
        if (iface.hasAttribute("String_Node_Str")) {
          String wsdlInfo=iface.getAttribute("String_Node_Str");
          Relationship relationship=SrampModelUtils.addGenericRelationship(componentArtifact,SwitchYardModel.REL_REFERENCES,null);
          relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + wsdlInfo);
        }
      }
    }
    NodeList services=(NodeList)this.query(xpath,node,"String_Node_Str",XPathConstants.NODESET);
    for (int jdx=0; jdx < services.getLength(); jdx++) {
      Element componentSvc=(Element)services.item(jdx);
      name=componentSvc.getAttribute("String_Node_Str");
      ExtendedArtifactType componentServiceArtifact=SwitchYardModel.newComponentServiceArtifact(name);
      componentServiceArtifact.setUuid(UUID.randomUUID().toString());
      derivedArtifacts.add(componentServiceArtifact);
      SrampModelUtils.addGenericRelationship(componentArtifact,SwitchYardModel.REL_OFFERS,componentServiceArtifact.getUuid());
      Element iface=(Element)this.query(xpath,componentSvc,"String_Node_Str",XPathConstants.NODE);
      if (iface != null) {
        if (iface.hasAttribute("String_Node_Str")) {
          String ifaceName=iface.getAttribute("String_Node_Str");
          Relationship relationship=SrampModelUtils.addGenericRelationship(componentServiceArtifact,SwitchYardModel.REL_IMPLEMENTS,null);
          relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + ifaceName);
        }
      }
      iface=(Element)this.query(xpath,componentSvc,"String_Node_Str",XPathConstants.NODE);
      if (iface != null) {
        if (iface.hasAttribute("String_Node_Str")) {
          String wsdlInfo=iface.getAttribute("String_Node_Str");
          Relationship relationship=SrampModelUtils.addGenericRelationship(componentServiceArtifact,SwitchYardModel.REL_IMPLEMENTS,null);
          relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + wsdlInfo);
        }
      }
      if (componentSvc.hasAttribute("String_Node_Str")) {
        String requires=componentSvc.getAttribute("String_Node_Str");
        SrampModelUtils.setCustomProperty(componentServiceArtifact,"String_Node_Str",requires);
      }
    }
  }
}