Program: 17935
Project: 17935
Buggy source:
private void buildCombinedTree(final ExpandSelectTreeNodeImpl root) throws EdmException {
  for (  SelectItem item : initialSelect) {
    ExpandSelectTreeNodeImpl actualNode=root;
    List<NavigationPropertySegment> segmentsList=item.getNavigationPropertySegments();
    for (int segmentListIndex=0; segmentListIndex < segmentsList.size(); segmentListIndex++) {
      ExpandSelectTreeNodeImpl childNode=null;
      for (      ArrayList<NavigationPropertySegment> singleExpandList : initialExpand) {
        if (singleExpandList.size() > segmentListIndex) {
          boolean ok=true;
          for (int expandListIndex=0; expandListIndex <= segmentListIndex; expandListIndex++) {
            if (!segmentsList.get(expandListIndex).getNavigationProperty().getName().equals(singleExpandList.get(expandListIndex).getNavigationProperty().getName())) {
              ok=false;
              break;
            }
          }
          if (ok) {
            childNode=new ExpandSelectTreeNodeImpl();
            if ((item.getProperty() == null && !item.isStar()) && segmentListIndex == segmentsList.size() - 1) {
              ExpandSelectTreeNodeImpl expandNodes=childNode;
              for (int expandListIndex=segmentListIndex + 1; expandListIndex < singleExpandList.size(); expandListIndex++) {
                ExpandSelectTreeNode newNode=new ExpandSelectTreeNodeImpl();
                expandNodes.setAllExplicitly();
                expandNodes=(ExpandSelectTreeNodeImpl)expandNodes.addChild(singleExpandList.get(expandListIndex).getNavigationProperty(),newNode);
              }
            }
            break;
          }
        }
      }
      actualNode=(ExpandSelectTreeNodeImpl)actualNode.addChild(segmentsList.get(segmentListIndex).getNavigationProperty(),childNode);
      if (actualNode == null) {
        break;
      }
    }
    if (actualNode != null) {
      if (item.getProperty() != null) {
        actualNode.addProperty(item.getProperty());
      }
 else       if (item.isStar()) {
        actualNode.setAllExplicitly();
      }
    }
  }
}

Fixed version (ground truth):
private void buildCombinedTree(final ExpandSelectTreeNodeImpl root) throws EdmException {
  for (  SelectItem item : initialSelect) {
    ExpandSelectTreeNodeImpl actualNode=root;
    List<NavigationPropertySegment> segmentsList=item.getNavigationPropertySegments();
    for (int segmentListIndex=0; segmentListIndex < segmentsList.size(); segmentListIndex++) {
      ExpandSelectTreeNodeImpl childNode=null;
      for (      ArrayList<NavigationPropertySegment> singleExpandList : initialExpand) {
        if (singleExpandList.size() > segmentListIndex) {
          boolean ok=true;
          for (int expandListIndex=0; expandListIndex <= segmentListIndex; expandListIndex++) {
            if (!segmentsList.get(expandListIndex).getNavigationProperty().getName().equals(singleExpandList.get(expandListIndex).getNavigationProperty().getName())) {
              ok=false;
              break;
            }
          }
          if (ok) {
            childNode=new ExpandSelectTreeNodeImpl();
            if ((item.getProperty() == null && !item.isStar()) && segmentListIndex == segmentsList.size() - 1) {
              ExpandSelectTreeNodeImpl expandNodes=childNode;
              expandNodes.setAllExplicitly();
              for (int expandListIndex=segmentListIndex + 1; expandListIndex < singleExpandList.size(); expandListIndex++) {
                ExpandSelectTreeNodeImpl newNode=new ExpandSelectTreeNodeImpl();
                newNode.setAllExplicitly();
                expandNodes=(ExpandSelectTreeNodeImpl)expandNodes.addChild(singleExpandList.get(expandListIndex).getNavigationProperty(),newNode);
              }
            }
            actualNode.addChild(segmentsList.get(segmentListIndex).getNavigationProperty(),childNode);
          }
        }
      }
      actualNode=(ExpandSelectTreeNodeImpl)actualNode.addChild(segmentsList.get(segmentListIndex).getNavigationProperty(),childNode);
      if (actualNode == null) {
        break;
      }
    }
    if (actualNode != null) {
      if (item.getProperty() != null) {
        actualNode.addProperty(item.getProperty());
      }
 else       if (item.isStar()) {
        actualNode.setAllExplicitly();
      }
    }
  }
}