Program: 50204
Project: 50204
Buggy source:
/** 
 * The synthesis method for creating the draft tree. Uses the refactored synthesis classes. This will store the synthesized topology as SYNTHCHILDOF relationships in the graph.
 * @param startNode this is the beginning node for analysis
 * @param preferredSourceIds this includes the list of preferred sources
 * @param test this will just run through the motions but won't store the synthesis 
 * @throws Exception 
 */
public boolean synthesizeAndStoreDraftTreeBranches(Node startNode,Iterable<String> preferredSourceIds,boolean test) throws Exception {
  ArrayList<Object> sourceIdPriorityList=new ArrayList<Object>();
  for (  String sourceId : preferredSourceIds) {
    sourceIdPriorityList.add(sourceId);
  }
  ArrayList<Object> justSourcePriorityList=new ArrayList<Object>();
  for (  String sourceId : preferredSourceIds) {
    justSourcePriorityList.add(sourceId.split("String_Node_Str")[0]);
  }
  ResolvingExpander draftSynthesisMethod=new ResolvingExpander();
  RelationshipFilter rf=new RelationshipFilter();
  HashSet<String> filteredsources=new HashSet<String>();
  IndexHits<Node> hits=sourceMetaIndex.query("String_Node_Str","String_Node_Str");
  while (hits.hasNext()) {
    Node n=hits.next();
    if (n.hasProperty("String_Node_Str")) {
      if (justSourcePriorityList.contains(n.getProperty("String_Node_Str")) == false) {
        filteredsources.add((String)n.getProperty("String_Node_Str"));
      }
    }
 else {
      if (justSourcePriorityList.contains(n.getProperty("String_Node_Str")) == false) {
        filteredsources.add((String)n.getProperty("String_Node_Str"));
      }
    }
  }
  System.out.println("String_Node_Str" + filteredsources);
  if (filteredsources.size() > 0) {
    rf.addCriterion(new SourcePropertyFilterCriterion(SourceProperty.STUDY_ID,FilterComparisonType.CONTAINS,new TestValue(filteredsources),sourceMetaIndex));
    draftSynthesisMethod.setFilter(rf);
  }
  RelationshipRanker rs=new RelationshipRanker();
  rs.addCriterion(new SourcePropertyPrioritizedRankingCriterion(SourceProperty.STUDY_ID,sourceIdPriorityList,sourceMetaIndex));
  rs.addCriterion(new SourcePropertyRankingCriterion(SourceProperty.YEAR,RankingOrder.DECREASING,sourceMetaIndex));
  draftSynthesisMethod.setRanker(rs);
  RelationshipConflictResolver rcr=new RelationshipConflictResolver(new RankResolutionMethodInferredPath());
  draftSynthesisMethod.setConflictResolver(rcr);
  System.out.println("String_Node_Str" + draftSynthesisMethod.getDescription());
  Node originalParent=null;
  knownIdsInTree=new HashSet<Long>();
  Transaction tx=graphDb.beginTx();
  String synthTreeName=DRAFTTREENAME;
  try {
    for (    Relationship rel : Traversal.description().breadthFirst().expand(draftSynthesisMethod).traverse(startNode).relationships()) {
      System.out.println("String_Node_Str" + rel.getId());
      Node parentNode=rel.getEndNode();
      Node curNode=rel.getStartNode();
      if (parentNode != null && test == false) {
        Relationship newRel=curNode.createRelationshipTo(parentNode,RelType.SYNTHCHILDOF);
        newRel.setProperty("String_Node_Str",synthTreeName);
        HashSet<String> sources=new HashSet<String>();
        for (        Relationship rel2 : curNode.getRelationships(RelType.STREECHILDOF)) {
          if (rel2.hasProperty("String_Node_Str")) {
            sources.add(String.valueOf(rel2.getProperty("String_Node_Str")));
          }
        }
        String[] sourcesArray=new String[sources.size()];
        Iterator<String> sourcesIter=sources.iterator();
        for (int i=0; i < sources.size(); i++) {
          sourcesArray[i]=sourcesIter.next();
        }
        newRel.setProperty("String_Node_Str",sourcesArray);
      }
      knownIdsInTree.add(curNode.getId());
    }
    tx.success();
  }
 catch (  Exception ex) {
    tx.failure();
    throw ex;
  }
 finally {
    tx.finish();
  }
  if (!test) {
    tx=graphDb.beginTx();
    try {
      addMissingChildrenToDraftTreeWhile(startNode,startNode);
      tx.success();
    }
 catch (    Exception ex) {
      tx.failure();
      ex.printStackTrace();
    }
 finally {
      tx.finish();
    }
  }
  System.out.println("String_Node_Str");
  return true;
}

Fixed version (ground truth):
/** 
 * The synthesis method for creating the draft tree. Uses the refactored synthesis classes. This will store the synthesized topology as SYNTHCHILDOF relationships in the graph.
 * @param startNode this is the beginning node for analysis
 * @param preferredSourceIds this includes the list of preferred sources
 * @param test this will just run through the motions but won't store the synthesis 
 * @throws Exception 
 */
public boolean synthesizeAndStoreDraftTreeBranches(Node startNode,Iterable<String> preferredSourceIds,boolean test) throws Exception {
  ArrayList<Object> sourceIdPriorityList=new ArrayList<Object>();
  for (  String sourceId : preferredSourceIds) {
    sourceIdPriorityList.add(sourceId);
  }
  ArrayList<Object> justSourcePriorityList=new ArrayList<Object>();
  for (  String sourceId : preferredSourceIds) {
    justSourcePriorityList.add(sourceId.split("String_Node_Str")[0]);
  }
  ResolvingExpander draftSynthesisMethod=new ResolvingExpander();
  RelationshipFilter rf=new RelationshipFilter();
  HashSet<String> filteredsources=new HashSet<String>();
  IndexHits<Node> hits=sourceMetaIndex.query("String_Node_Str","String_Node_Str");
  while (hits.hasNext()) {
    Node n=hits.next();
    if (n.hasProperty("String_Node_Str")) {
      if (justSourcePriorityList.contains(n.getProperty("String_Node_Str")) == false) {
        filteredsources.add((String)n.getProperty("String_Node_Str"));
      }
    }
 else {
      if (justSourcePriorityList.contains(n.getProperty("String_Node_Str")) == false) {
        filteredsources.add((String)n.getProperty("String_Node_Str"));
      }
    }
  }
  System.out.println("String_Node_Str" + filteredsources);
  if (filteredsources.size() > 0) {
    rf.addCriterion(new SourcePropertyFilterCriterion(SourceProperty.STUDY_ID,FilterComparisonType.CONTAINS,new TestValue(filteredsources),sourceMetaIndex));
    draftSynthesisMethod.setFilter(rf);
  }
  RelationshipRanker rs=new RelationshipRanker();
  rs.addCriterion(new SourcePropertyPrioritizedRankingCriterion(SourceProperty.STUDY_ID,sourceIdPriorityList,sourceMetaIndex));
  rs.addCriterion(new SourcePropertyRankingCriterion(SourceProperty.YEAR,RankingOrder.DECREASING,sourceMetaIndex));
  draftSynthesisMethod.setRanker(rs);
  RelationshipConflictResolver rcr=new RelationshipConflictResolver(new RankResolutionMethodInferredPath());
  draftSynthesisMethod.setConflictResolver(rcr);
  System.out.println("String_Node_Str" + draftSynthesisMethod.getDescription());
  Node originalParent=null;
  knownIdsInTree=new HashSet<Long>();
  Transaction tx=graphDb.beginTx();
  String synthTreeName=DRAFTTREENAME;
  try {
    for (    Relationship rel : Traversal.description().breadthFirst().expand(draftSynthesisMethod).traverse(startNode).relationships()) {
      Node parentNode=rel.getEndNode();
      Node curNode=rel.getStartNode();
      if (parentNode != null && test == false) {
        Relationship newRel=curNode.createRelationshipTo(parentNode,RelType.SYNTHCHILDOF);
        newRel.setProperty("String_Node_Str",synthTreeName);
        HashSet<String> sources=new HashSet<String>();
        for (        Relationship rel2 : curNode.getRelationships(RelType.STREECHILDOF)) {
          if (rel2.hasProperty("String_Node_Str")) {
            sources.add(String.valueOf(rel2.getProperty("String_Node_Str")));
          }
        }
        String[] sourcesArray=new String[sources.size()];
        Iterator<String> sourcesIter=sources.iterator();
        for (int i=0; i < sources.size(); i++) {
          sourcesArray[i]=sourcesIter.next();
        }
        newRel.setProperty("String_Node_Str",sourcesArray);
      }
      knownIdsInTree.add(curNode.getId());
    }
    tx.success();
  }
 catch (  Exception ex) {
    tx.failure();
    throw ex;
  }
 finally {
    tx.finish();
  }
  if (!test) {
    tx=graphDb.beginTx();
    try {
      addMissingChildrenToDraftTreeWhile(startNode,startNode);
      tx.success();
    }
 catch (    Exception ex) {
      tx.failure();
      ex.printStackTrace();
    }
 finally {
      tx.finish();
    }
  }
  System.out.println("String_Node_Str");
  return true;
}