Program: 178903
Project: 178903
Buggy source:
@Override public Object[] getChildren(Object object){
  if (object instanceof XWikiEclipsePageSummary) {
    final XWikiEclipsePageSummary pageSummary=(XWikiEclipsePageSummary)object;
    try {
      DataManager dataManager=pageSummary.getDataManager();
      List<XWikiEclipseObjectSummary> objects=dataManager.getObjectSummaries(pageSummary);
      List<XWikiEclipseAttachment> attachments=dataManager.getAttachments(pageSummary);
      XWikiEclipseClass pageClass=dataManager.getClass(pageSummary);
      List<XWikiEclipseTag> tags=dataManager.getTags(pageSummary);
      List<XWikiEclipseComment> comments=dataManager.getComments(pageSummary);
      List<ModelObject> result=new ArrayList<ModelObject>();
      String pageId=pageSummary.getId();
      result.add(pageClass);
      if (attachments != null && attachments.size() > 0) {
        XWikiEclipseObjectCollection a=new XWikiEclipseObjectCollection(dataManager);
        a.setClassName("String_Node_Str");
        a.setPageId(pageId);
        for (        XWikiEclipseAttachment attach : attachments) {
          a.getObjects().add(attach);
        }
        if (a.getObjects().size() > 0) {
          result.add(a);
        }
      }
      if (tags != null && tags.size() > 0) {
        XWikiEclipseObjectCollection t=new XWikiEclipseObjectCollection(dataManager);
        t.setClassName("String_Node_Str");
        t.setPageId(pageId);
        for (        XWikiEclipseTag tag : tags) {
          t.getObjects().add(tag);
        }
        if (t.getObjects().size() > 0) {
          result.add(t);
        }
      }
      if (comments != null && comments.size() > 0) {
        XWikiEclipseObjectCollection t=new XWikiEclipseObjectCollection(dataManager);
        t.setClassName("String_Node_Str");
        t.setPageId(pageId);
        for (        XWikiEclipseComment comment : comments) {
          t.getObjects().add(comment);
        }
        if (t.getObjects().size() > 0) {
          result.add(t);
        }
      }
      if (objects != null && objects.size() > 0) {
        XWikiEclipseObjectCollection collection=new XWikiEclipseObjectCollection(dataManager);
        collection.setClassName("String_Node_Str");
        collection.setPageId(pageId);
        Map<String,XWikiEclipseObjectCollection> classnameCollectionMap=new HashMap<String,XWikiEclipseObjectCollection>();
        for (        XWikiEclipseObjectSummary objectSummary : objects) {
          if (!objectSummary.getClassName().equals("String_Node_Str") && !objectSummary.getClassName().equals("String_Node_Str")) {
            String classname=objectSummary.getClassName();
            if (classnameCollectionMap.containsKey(classname)) {
              classnameCollectionMap.get(classname).getObjects().add(objectSummary);
            }
 else {
              XWikiEclipseObjectCollection subCollection=new XWikiEclipseObjectCollection(dataManager);
              subCollection.setPageId(pageId);
              if (classname.equals("String_Node_Str")) {
                subCollection.setClassName("String_Node_Str");
              }
 else               if (classname.equals("String_Node_Str")) {
                subCollection.setClassName("String_Node_Str");
              }
 else {
                subCollection.setClassName(classname);
              }
              subCollection.getObjects().add(objectSummary);
              classnameCollectionMap.put(classname,subCollection);
              collection.getObjects().add(subCollection);
            }
          }
        }
        result.add(collection);
      }
      return result.toArray();
    }
 catch (    XWikiEclipseStorageException e) {
      UIUtils.showMessageDialog(Display.getDefault().getActiveShell(),SWT.ICON_ERROR,"String_Node_Str","String_Node_Str");
      pageSummary.getDataManager().disconnect();
      CoreLog.logError("String_Node_Str",e);
      return NO_CHILDREN;
    }
  }
  return super.getChildren(object);
}

Fixed version (ground truth):
@Override public Object[] getChildren(Object object){
  if (object instanceof XWikiEclipsePageSummary) {
    final XWikiEclipsePageSummary pageSummary=(XWikiEclipsePageSummary)object;
    try {
      DataManager dataManager=pageSummary.getDataManager();
      List<XWikiEclipseObjectSummary> objects=dataManager.getObjectSummaries(pageSummary);
      List<XWikiEclipseAttachment> attachments=dataManager.getAttachments(pageSummary);
      XWikiEclipseClass pageClass=dataManager.getClass(pageSummary);
      List<XWikiEclipseTag> tags=dataManager.getTags(pageSummary);
      List<XWikiEclipseComment> comments=dataManager.getComments(pageSummary);
      List<ModelObject> result=new ArrayList<ModelObject>();
      String pageId=pageSummary.getId();
      result.add(pageClass);
      if (attachments != null && attachments.size() > 0) {
        XWikiEclipseObjectCollection a=new XWikiEclipseObjectCollection(dataManager);
        a.setClassName("String_Node_Str");
        a.setPageId(pageId);
        for (        XWikiEclipseAttachment attach : attachments) {
          a.getObjects().add(attach);
        }
        if (a.getObjects().size() > 0) {
          result.add(a);
        }
      }
      if (tags != null && tags.size() > 0) {
        XWikiEclipseObjectCollection t=new XWikiEclipseObjectCollection(dataManager);
        t.setClassName("String_Node_Str");
        t.setPageId(pageId);
        for (        XWikiEclipseTag tag : tags) {
          t.getObjects().add(tag);
        }
        if (t.getObjects().size() > 0) {
          result.add(t);
        }
      }
      if (comments != null && comments.size() > 0) {
        XWikiEclipseObjectCollection t=new XWikiEclipseObjectCollection(dataManager);
        t.setClassName("String_Node_Str");
        t.setPageId(pageId);
        for (        XWikiEclipseComment comment : comments) {
          t.getObjects().add(comment);
        }
        if (t.getObjects().size() > 0) {
          result.add(t);
        }
      }
      if (objects != null && objects.size() > 0) {
        XWikiEclipseObjectCollection collection=null;
        Map<String,XWikiEclipseObjectCollection> classnameCollectionMap=new HashMap<String,XWikiEclipseObjectCollection>();
        for (        XWikiEclipseObjectSummary objectSummary : objects) {
          if (!objectSummary.getClassName().equals("String_Node_Str") && !objectSummary.getClassName().equals("String_Node_Str")) {
            String classname=objectSummary.getClassName();
            if (classnameCollectionMap.containsKey(classname)) {
              classnameCollectionMap.get(classname).getObjects().add(objectSummary);
            }
 else {
              XWikiEclipseObjectCollection subCollection=new XWikiEclipseObjectCollection(dataManager);
              subCollection.setPageId(pageId);
              if (classname.equals("String_Node_Str")) {
                subCollection.setClassName("String_Node_Str");
              }
 else               if (classname.equals("String_Node_Str")) {
                subCollection.setClassName("String_Node_Str");
              }
 else {
                subCollection.setClassName(classname);
              }
              subCollection.getObjects().add(objectSummary);
              classnameCollectionMap.put(classname,subCollection);
              if (collection == null) {
                collection=new XWikiEclipseObjectCollection(dataManager);
                collection.setClassName("String_Node_Str");
                collection.setPageId(pageId);
              }
              collection.getObjects().add(subCollection);
            }
          }
        }
        if (collection != null) {
          result.add(collection);
        }
      }
      return result.toArray();
    }
 catch (    XWikiEclipseStorageException e) {
      UIUtils.showMessageDialog(Display.getDefault().getActiveShell(),SWT.ICON_ERROR,"String_Node_Str","String_Node_Str");
      pageSummary.getDataManager().disconnect();
      CoreLog.logError("String_Node_Str",e);
      return NO_CHILDREN;
    }
  }
  return super.getChildren(object);
}