Program: 136364
Project: 136364
Buggy source:
/** 
 * @param children
 * @return
 */
private List<ExampleModel> generateExamplesForNode(List<Node> children,ValidationFindings findingsAggregator){
  List<ExampleModel> ret=new ArrayList<ExampleModel>();
  for (  Node child : children) {
    NamedEntity namedEntity=getNamedEntity(child);
    if (namedEntity != null) {
      ExampleModel childModel=null;
      try {
        Object[] examples=generateExample(namedEntity);
        if (child instanceof VersionNode) {
          child=((VersionNode)child).getHead();
        }
        if (child.isService()) {
          childModel=new ExampleModel(child);
          childModel.addChildren(generateExamplesForNode(child.getChildren(),findingsAggregator));
        }
 else         if (child.isOperation()) {
          childModel=new ExampleModel(child);
          childModel.addChildren(generateExamplesForNode(child.getChildren(),findingsAggregator));
        }
 else {
          if (namedEntity instanceof TLFacet) {
            TLFacet facet=(TLFacet)namedEntity;
            if (!facet.declaresContent()) {
              break;
            }
          }
          if (((Document)examples[0]).getDocumentElement() != null) {
            childModel=new DOMExampleModel(child,((Document)examples[0]).getDocumentElement());
            childModel.setXmlString((String)examples[1]);
          }
        }
      }
 catch (      ValidationException e) {
        childModel=new ErrorExampleModel(child);
        findingsAggregator.addAll(e.getFindings());
        LOGGER.debug("String_Node_Str" + Arrays.toString(e.getFindings().getAllValidationMessages(FindingMessageFormat.IDENTIFIED_FORMAT)));
      }
catch (      CodeGenerationException e) {
        DialogUserNotifier.openError("String_Node_Str","String_Node_Str" + e);
        LOGGER.error("String_Node_Str",e);
      }
      if (childModel != null)       ret.add(childModel);
    }
 else     if (!child.getChildren().isEmpty()) {
      ret.addAll(generateExamplesForNode(child.getChildren(),findingsAggregator));
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * @param children
 * @return
 */
private List<ExampleModel> generateExamplesForNode(List<Node> children,ValidationFindings findingsAggregator){
  List<ExampleModel> ret=new ArrayList<ExampleModel>();
  for (  Node child : children) {
    NamedEntity namedEntity=getNamedEntity(child);
    if (namedEntity != null) {
      ExampleModel childModel=null;
      try {
        Object[] examples=generateExample(namedEntity);
        if (child instanceof VersionNode) {
          child=((VersionNode)child).getNewestVersion();
        }
        if (child.isService()) {
          childModel=new ExampleModel(child);
          childModel.addChildren(generateExamplesForNode(child.getChildren(),findingsAggregator));
        }
 else         if (child.isOperation()) {
          childModel=new ExampleModel(child);
          childModel.addChildren(generateExamplesForNode(child.getChildren(),findingsAggregator));
        }
 else {
          if (namedEntity instanceof TLFacet) {
            TLFacet facet=(TLFacet)namedEntity;
            if (!facet.declaresContent()) {
              break;
            }
          }
          if (((Document)examples[0]).getDocumentElement() != null) {
            childModel=new DOMExampleModel(child,((Document)examples[0]).getDocumentElement());
            childModel.setXmlString((String)examples[1]);
          }
        }
      }
 catch (      ValidationException e) {
        childModel=new ErrorExampleModel(child);
        findingsAggregator.addAll(e.getFindings());
        LOGGER.debug("String_Node_Str" + Arrays.toString(e.getFindings().getAllValidationMessages(FindingMessageFormat.IDENTIFIED_FORMAT)));
      }
catch (      CodeGenerationException e) {
        DialogUserNotifier.openError("String_Node_Str","String_Node_Str" + e);
        LOGGER.error("String_Node_Str",e);
      }
      if (childModel != null)       ret.add(childModel);
    }
 else     if (!child.getChildren().isEmpty()) {
      ret.addAll(generateExamplesForNode(child.getChildren(),findingsAggregator));
    }
  }
  return ret;
}