Program: 64802
Project: 64802
Buggy source:
/** 
 * Find a child node with value equal to the given value. If no such child exists, return <code>null</code>.
 * @param parent parent of the node to be found.
 * @param value  value of the node to be found.
 * @return child node, <code>null</code> of none exists.
 */
private Node findChild(Node parent,int value,ChildNotFoundPolicy childNotFoundPolicy){
  Relationship firstRelationship=parent.getSingleRelationship(FIRST,OUTGOING);
  if (firstRelationship == null) {
    return null;
  }
  Node existingChild=firstRelationship.getEndNode();
  while (getInt(existingChild,VALUE_PROPERTY) < value && parent(existingChild).equals(parent)) {
    Relationship nextRelationship=existingChild.getSingleRelationship(NEXT,OUTGOING);
    if (nextRelationship == null) {
switch (childNotFoundPolicy) {
case RETURN_NULL:
        return null;
case RETURN_NEXT:
      return null;
case RETURN_PREVIOUS:
    return existingChild;
}
}
if (!parent(nextRelationship.getEndNode()).equals(parent)) {
switch (childNotFoundPolicy) {
case RETURN_NULL:
  return null;
case RETURN_NEXT:
return nextRelationship.getEndNode();
case RETURN_PREVIOUS:
return existingChild;
}
}
existingChild=nextRelationship.getEndNode();
}
if (getInt(existingChild,VALUE_PROPERTY) == value) {
return existingChild;
}
switch (childNotFoundPolicy) {
case RETURN_NULL:
return null;
case RETURN_NEXT:
return existingChild;
case RETURN_PREVIOUS:
return existingChild.getSingleRelationship(NEXT,INCOMING).getStartNode();
default :
throw new IllegalStateException("String_Node_Str" + childNotFoundPolicy);
}
}

Fixed version (ground truth):
/** 
 * Find a child node with value equal to the given value. If no such child exists, return <code>null</code>.
 * @param parent parent of the node to be found.
 * @param value  value of the node to be found.
 * @return child node, <code>null</code> of none exists.
 */
private Node findChild(Node parent,int value,ChildNotFoundPolicy childNotFoundPolicy){
  Relationship firstRelationship=parent.getSingleRelationship(FIRST,OUTGOING);
  if (firstRelationship == null) {
    return null;
  }
  Node existingChild=firstRelationship.getEndNode();
  while (getInt(existingChild,VALUE_PROPERTY) < value && parent(existingChild).equals(parent)) {
    Relationship nextRelationship=existingChild.getSingleRelationship(NEXT,OUTGOING);
    if (nextRelationship == null) {
switch (childNotFoundPolicy) {
case RETURN_NULL:
        return null;
case RETURN_NEXT:
      return null;
case RETURN_PREVIOUS:
    return existingChild;
}
}
if (!parent(nextRelationship.getEndNode()).equals(parent)) {
switch (childNotFoundPolicy) {
case RETURN_NULL:
  return null;
case RETURN_NEXT:
return nextRelationship.getEndNode();
case RETURN_PREVIOUS:
return existingChild;
}
}
existingChild=nextRelationship.getEndNode();
}
if (getInt(existingChild,VALUE_PROPERTY) == value) {
return existingChild;
}
switch (childNotFoundPolicy) {
case RETURN_NULL:
return null;
case RETURN_NEXT:
return existingChild;
case RETURN_PREVIOUS:
return existingChild.getSingleRelationship(NEXT,INCOMING) == null ? null : existingChild.getSingleRelationship(NEXT,INCOMING).getStartNode();
default :
throw new IllegalStateException("String_Node_Str" + childNotFoundPolicy);
}
}