Program: 13011
Project: 13011
Buggy source:
/** 
 * Create derived transformers found in the switchyard.xml.
 * @param derivedArtifacts
 * @param artifact
 * @param rootElement
 * @param xpath
 * @throws XPathExpressionException
 */
private void processTransformers(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");
    if (name == null || name.trim().length() == 0) {
      if (node.hasAttribute("String_Node_Str") && node.hasAttribute("String_Node_Str")) {
        String from=node.getAttribute("String_Node_Str");
        String to=node.getAttribute("String_Node_Str");
        if (from.startsWith("String_Node_Str")) {
          name=from.substring(from.lastIndexOf("String_Node_Str") + 1);
        }
 else         if (from.startsWith("String_Node_Str")) {
          name=from.substring(from.lastIndexOf('.') + 1);
        }
        if (to.startsWith("String_Node_Str")) {
          name=name + "String_Node_Str" + to.substring(to.lastIndexOf("String_Node_Str") + 1);
        }
 else         if (to.startsWith("String_Node_Str")) {
          name=name + "String_Node_Str" + to.substring(from.lastIndexOf('.') + 1);
        }
      }
 else {
        name=node.getLocalName();
      }
    }
    ExtendedArtifactType transformerArtifact=SwitchYardModel.newTransformerArtifact(name);
    String type=node.getLocalName();
    type=type.substring(type.lastIndexOf('.') + 1);
    SrampModelUtils.setCustomProperty(transformerArtifact,SwitchYardModel.PROP_TRANSFORMER_TYPE,type);
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_TRANSFORMS_FROM,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_TRANSFORMS_TO,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,node.getAttribute("String_Node_Str"));
    }
    derivedArtifacts.add(transformerArtifact);
  }
}

Fixed version (ground truth):
/** 
 * Create derived transformers found in the switchyard.xml.
 * @param derivedArtifacts
 * @param artifact
 * @param rootElement
 * @param xpath
 * @throws XPathExpressionException
 */
private void processTransformers(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");
    if (name == null || name.trim().length() == 0) {
      if (node.hasAttribute("String_Node_Str") && node.hasAttribute("String_Node_Str")) {
        String from=node.getAttribute("String_Node_Str");
        String to=node.getAttribute("String_Node_Str");
        if (from.startsWith("String_Node_Str")) {
          name=from.substring(from.lastIndexOf("String_Node_Str") + 1);
        }
 else         if (from.startsWith("String_Node_Str")) {
          name=from.substring(from.lastIndexOf('.') + 1);
        }
        if (to.startsWith("String_Node_Str")) {
          name=name + "String_Node_Str" + to.substring(to.lastIndexOf("String_Node_Str") + 1);
        }
 else         if (to.startsWith("String_Node_Str")) {
          name=name + "String_Node_Str" + to.substring(to.lastIndexOf('.') + 1);
        }
      }
 else {
        name=node.getLocalName();
      }
    }
    ExtendedArtifactType transformerArtifact=SwitchYardModel.newTransformerArtifact(name);
    String type=node.getLocalName();
    type=type.substring(type.lastIndexOf('.') + 1);
    SrampModelUtils.setCustomProperty(transformerArtifact,SwitchYardModel.PROP_TRANSFORMER_TYPE,type);
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_IMPLEMENTED_BY,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,"String_Node_Str" + node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_TRANSFORMS_FROM,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,node.getAttribute("String_Node_Str"));
    }
    if (node.hasAttribute("String_Node_Str")) {
      Relationship relationship=SrampModelUtils.addGenericRelationship(transformerArtifact,SwitchYardModel.REL_TRANSFORMS_TO,null);
      relationship.getOtherAttributes().put(UNRESOLVED_REF,node.getAttribute("String_Node_Str"));
    }
    derivedArtifacts.add(transformerArtifact);
  }
}