Program: 50217
Project: 50217
Buggy source:
/** 
 * @param maxDepth is the max number of edges between the root and an included nodeif non-negative this can be used to prune off subtrees that exceed the threshold distance from the root. If maxDepth is negative, no threshold is applied
 */
private JadeTree reconstructSyntheticTreeHelper(String treeID,Node rootnode,int maxDepth){
  JadeNode root=new JadeNode();
  if (rootnode.hasProperty("String_Node_Str")) {
    root.setName((String)rootnode.getProperty("String_Node_Str"));
  }
  root.assocObject("String_Node_Str",rootnode.getId());
  boolean printlengths=false;
  HashMap<Node,JadeNode> node2JadeNode=new HashMap<Node,JadeNode>();
  node2JadeNode.put(rootnode,root);
  TraversalDescription synthEdgeTraversal=Traversal.description().relationships(RelTypes.SYNTHCHILDOF,Direction.INCOMING);
  synthEdgeTraversal=synthEdgeTraversal.depthFirst();
  if (maxDepth >= 0) {
    synthEdgeTraversal=synthEdgeTraversal.evaluator(Evaluators.toDepth(maxDepth));
  }
  for (  Path path : synthEdgeTraversal.traverse(rootnode)) {
    Relationship furshestRel=path.lastRelationship();
    if (furshestRel != null && furshestRel.hasProperty("String_Node_Str")) {
      String rn=(String)furshestRel.getProperty("String_Node_Str");
      if (rn.equals(treeID)) {
        Node parNode=furshestRel.getEndNode();
        Node childNode=furshestRel.getStartNode();
        JadeNode jChild=new JadeNode();
        final long cid=childNode.getId();
        if (childNode.hasProperty("String_Node_Str")) {
          jChild.setName((String)childNode.getProperty("String_Node_Str"));
        }
        jChild.assocObject("String_Node_Str",cid);
        if (furshestRel.hasProperty("String_Node_Str")) {
          printlengths=true;
          jChild.setBL((Double)furshestRel.getProperty("String_Node_Str"));
        }
        node2JadeNode.get(parNode).addChild(jChild);
        node2JadeNode.put(childNode,jChild);
      }
    }
  }
  JadeTree tree=new JadeTree(root);
  tree.setHasBranchLengths(printlengths);
  return tree;
}

Fixed version (ground truth):
/** 
 * @param maxDepth is the max number of edges between the root and an included nodeif non-negative this can be used to prune off subtrees that exceed the threshold distance from the root. If maxDepth is negative, no threshold is applied
 */
private JadeTree reconstructSyntheticTreeHelper(String treeID,Node rootnode,int maxDepth){
  JadeNode root=new JadeNode();
  if (rootnode.hasProperty("String_Node_Str")) {
    root.setName((String)rootnode.getProperty("String_Node_Str"));
  }
  root.assocObject("String_Node_Str",rootnode.getId());
  boolean printlengths=false;
  HashMap<Node,JadeNode> node2JadeNode=new HashMap<Node,JadeNode>();
  node2JadeNode.put(rootnode,root);
  TraversalDescription synthEdgeTraversal=Traversal.description().relationships(RelTypes.SYNTHCHILDOF,Direction.INCOMING);
  synthEdgeTraversal=synthEdgeTraversal.depthFirst();
  if (maxDepth >= 0) {
    synthEdgeTraversal=synthEdgeTraversal.evaluator(Evaluators.toDepth(maxDepth));
  }
  for (  Path path : synthEdgeTraversal.traverse(rootnode)) {
    Relationship furshestRel=path.lastRelationship();
    if (furshestRel != null && furshestRel.hasProperty("String_Node_Str")) {
      String rn=(String)furshestRel.getProperty("String_Node_Str");
      if (rn.equals(treeID)) {
        Node parNode=furshestRel.getEndNode();
        Node childNode=furshestRel.getStartNode();
        JadeNode jChild=new JadeNode();
        final long cid=childNode.getId();
        if (childNode.hasProperty("String_Node_Str")) {
          jChild.setName((String)childNode.getProperty("String_Node_Str"));
        }
        jChild.assocObject("String_Node_Str",cid);
        if (furshestRel.hasProperty("String_Node_Str")) {
          printlengths=true;
          jChild.setBL((Double)furshestRel.getProperty("String_Node_Str"));
        }
        node2JadeNode.get(parNode).addChild(jChild);
        node2JadeNode.put(childNode,jChild);
      }
    }
  }
  JadeTree tree=new JadeTree(root);
  root.assocObject("String_Node_Str",root.getNodeMaxDepth());
  tree.setHasBranchLengths(printlengths);
  return tree;
}