Program: 102374
Project: 102374
Buggy source:
/** 
 * Create the DisplayNode list for this type of DisplayNode. This is a list of all the lowest level nodes for this DisplayNode.
 */
private void createDisplayNodeList(){
  displayNodeList=new ArrayList();
  JoinPredicate joinPredicate=(JoinPredicate)this.getLanguageObject();
  if (joinPredicate.isOptional()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,OPTIONAL_COMMENTS));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
  }
  if (joinPredicate.hasHint()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,LTPAREN));
  }
  DisplayNode child=(DisplayNode)childNodeList.get(0);
  if (child instanceof JoinPredicateDisplayNode && !joinPredicate.getLeftClause().hasHint()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,LTPAREN));
    if (child.hasDisplayNodes()) {
      displayNodeList.addAll(child.getDisplayNodeList());
    }
 else {
      displayNodeList.add(child);
    }
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,RTPAREN));
  }
 else {
    if (child.hasDisplayNodes()) {
      displayNodeList.addAll(child.getDisplayNodeList());
    }
 else {
      displayNodeList.add(child);
    }
  }
  JoinType joinType=joinPredicate.getJoinType();
  if (joinType == null) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,ERROR));
  }
 else {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,joinType.toString()));
  }
  displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
  child=(DisplayNode)childNodeList.get(1);
  if (child instanceof JoinPredicateDisplayNode && !joinPredicate.getRightClause().hasHint()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,LTPAREN));
    if (child.hasDisplayNodes()) {
      displayNodeList.addAll(child.getDisplayNodeList());
    }
 else {
      displayNodeList.add(child);
    }
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,RTPAREN));
  }
 else {
    if (child.hasDisplayNodes()) {
      displayNodeList.addAll(child.getDisplayNodeList());
    }
 else {
      displayNodeList.add(child);
    }
  }
  if (childNodeList.size() > 2) {
    Iterator iter=childNodeList.iterator();
    if (iter.hasNext())     iter.next();
    if (iter.hasNext())     iter.next();
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,ReservedWords.ON));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
    while (iter.hasNext()) {
      child=(DisplayNode)iter.next();
      if (child instanceof PredicateCriteriaDisplayNode) {
        if (child.hasDisplayNodes()) {
          displayNodeList.addAll(child.getDisplayNodeList());
        }
 else {
          displayNodeList.add(child);
        }
      }
 else {
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,LTPAREN));
        if (child.hasDisplayNodes()) {
          displayNodeList.addAll(child.getDisplayNodeList());
        }
 else {
          displayNodeList.add(child);
        }
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,RTPAREN));
      }
      if (iter.hasNext()) {
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,ReservedWords.AND));
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
      }
    }
  }
  if (joinPredicate.hasHint()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,RTPAREN));
  }
  addFromClauseDepOptions(joinPredicate);
}

Fixed version (ground truth):
/** 
 * Create the DisplayNode list for this type of DisplayNode. This is a list of all the lowest level nodes for this DisplayNode.
 */
private void createDisplayNodeList(){
  displayNodeList=new ArrayList();
  JoinPredicate joinPredicate=(JoinPredicate)this.getLanguageObject();
  if (joinPredicate.isOptional()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,OPTIONAL_COMMENTS));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
  }
  if (joinPredicate.hasHint()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,LTPAREN));
  }
  DisplayNode child=(DisplayNode)childNodeList.get(0);
  if (child instanceof JoinPredicateDisplayNode && !joinPredicate.getLeftClause().hasHint()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,LTPAREN));
    if (child.hasDisplayNodes()) {
      displayNodeList.addAll(child.getDisplayNodeList());
    }
 else {
      displayNodeList.add(child);
    }
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,RTPAREN));
  }
 else {
    if (child.hasDisplayNodes()) {
      displayNodeList.addAll(child.getDisplayNodeList());
    }
 else {
      displayNodeList.add(child);
    }
  }
  JoinType joinType=joinPredicate.getJoinType();
  if (joinType == null) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,ERROR));
  }
 else {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,joinType.toString()));
  }
  displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
  child=(DisplayNode)childNodeList.get(1);
  if (child instanceof JoinPredicateDisplayNode && !joinPredicate.getRightClause().hasHint()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,LTPAREN));
    if (child.hasDisplayNodes()) {
      displayNodeList.addAll(child.getDisplayNodeList());
    }
 else {
      displayNodeList.add(child);
    }
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,RTPAREN));
  }
 else {
    if (child.hasDisplayNodes()) {
      displayNodeList.addAll(child.getDisplayNodeList());
    }
 else {
      displayNodeList.add(child);
    }
  }
  List joinCriteria=joinPredicate.getJoinCriteria();
  if (joinCriteria != null && joinCriteria.size() > 0) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,ReservedWords.ON));
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
    Iterator critIter=joinCriteria.iterator();
    while (critIter.hasNext()) {
      Criteria crit=(Criteria)critIter.next();
      if (crit instanceof PredicateCriteria) {
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,crit));
      }
 else {
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,LTPAREN));
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,crit));
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,RTPAREN));
      }
      if (critIter.hasNext()) {
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,ReservedWords.AND));
        displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,SPACE));
      }
    }
  }
  if (joinPredicate.hasHint()) {
    displayNodeList.add(DisplayNodeFactory.createDisplayNode(this,RTPAREN));
  }
  addFromClauseDepOptions(joinPredicate);
}