Program: 148215
Project: 148215
Buggy source:
private void setOptimizedCheckNodes(TreeParent obj){
  for (  TreeObject treeObj : obj.getChildren()) {
    if (treeObj.getName().equals("String_Node_Str")) {
      if (treeObj instanceof TreeParent) {
        for (        TreeObject child : ((TreeParent)treeObj).getChildren()) {
          if (!(child instanceof TreeParent)) {
            optimizedCheckNodes.add(child);
          }
 else {
            if (child.getName().equals("String_Node_Str")) {
              for (              TreeObject chld : ((TreeParent)child).getChildren()) {
                if (chld.getName().equals("String_Node_Str"))                 optimizedCheckNodes.add(chld);
                if (chld.getName().equals("String_Node_Str"))                 optimizedCheckNodes.add(chld);
              }
            }
          }
        }
      }
    }
    if (treeObj.getName().equals("String_Node_Str")) {
      if (treeObj instanceof TreeParent) {
        optimizedCheckNodes.add(treeObj);
      }
    }
    if (treeObj.getName().equals("String_Node_Str") || treeObj.getName().equals("String_Node_Str")) {
      if (treeObj instanceof TreeParent) {
        for (        TreeObject child : ((TreeParent)treeObj).getChildren()) {
          if (!(child instanceof TreeParent)) {
            optimizedCheckNodes.add(child);
          }
        }
      }
    }
    if (treeObj.getName().equals("String_Node_Str")) {
      if (treeObj instanceof TreeParent) {
        for (        TreeObject child : ((TreeParent)treeObj).getChildren()) {
          if (child.getName().equals("String_Node_Str"))           optimizedCheckNodes.add(child);
        }
      }
    }
  }
  for (  TreeObject treeObj : obj.getChildren()) {
    if (treeObj.getName().equals("String_Node_Str")) {
      if (treeObj instanceof TreeParent) {
        for (        TreeObject child : ((TreeParent)treeObj).getChildren()) {
          if (!(child instanceof TreeParent)) {
            optimizedCheckNodes.add(child);
          }
 else {
            optimizedCheckNodes.remove(child);
          }
        }
      }
    }
  }
  ((CheckboxTreeViewer)viewer).setCheckedElements(optimizedCheckNodes.toArray());
}

Fixed version (ground truth):
private void setOptimizedCheckNodes(TreeParent obj){
  for (  TreeObject treeObj : obj.getChildren()) {
    if (treeObj.getName().equals("String_Node_Str")) {
      if (treeObj instanceof TreeParent) {
        for (        TreeObject child : ((TreeParent)treeObj).getChildren()) {
          if (!(child instanceof TreeParent)) {
            optimizedCheckNodes.add(child);
          }
 else {
            if (child.getName().equals("String_Node_Str")) {
              for (              TreeObject chld : ((TreeParent)child).getChildren()) {
                if (chld.getName().equals("String_Node_Str"))                 optimizedCheckNodes.add(chld);
                if (chld.getName().equals("String_Node_Str"))                 optimizedCheckNodes.add(chld);
              }
            }
          }
        }
      }
    }
    if (treeObj.getName().equals("String_Node_Str")) {
      if (treeObj instanceof TreeParent) {
        optimizedCheckNodes.add(treeObj);
      }
    }
    if (treeObj.getName().equals("String_Node_Str") || treeObj.getName().equals("String_Node_Str") || treeObj.getName().equals("String_Node_Str")) {
      if (treeObj instanceof TreeParent) {
        for (        TreeObject child : ((TreeParent)treeObj).getChildren()) {
          if (!(child instanceof TreeParent)) {
            optimizedCheckNodes.add(child);
          }
        }
      }
    }
    if (treeObj.getName().equals("String_Node_Str")) {
      if (treeObj instanceof TreeParent) {
        for (        TreeObject child : ((TreeParent)treeObj).getChildren()) {
          if (child.getName().equals("String_Node_Str"))           optimizedCheckNodes.add(child);
        }
      }
    }
  }
  ((CheckboxTreeViewer)viewer).setCheckedElements(optimizedCheckNodes.toArray());
}