Program: 138815
Project: 138815
Buggy source:
@Override public Object[] getChildren(Object element){
  if (element instanceof IWorkspaceRoot) {
    Object currentOpenProject=null;
    for (    Object child : super.getChildren(element)) {
      if (child instanceof IProject) {
        if (((IProject)child).getName().equals(ResourceManager.getRootProjectName())) {
          currentOpenProject=child;
          break;
        }
      }
    }
    List<Object> folders=new ArrayList<Object>();
    try {
      Object[] rootFolders=new Object[0];
      rootFolders=((IProject)currentOpenProject).members(false);
      for (      Object folder : rootFolders) {
        if (folder instanceof IFolder && ((IFolder)folder).getName().startsWith(DQStructureManager.PREFIX_TDQ)) {
          if (((IFolder)folder).getName().trim().equals("String_Node_Str")) {
            continue;
          }
          folders.add(folder);
        }
        if (folder instanceof IFolder && ((IFolder)folder).getName().equals(EResourceConstant.METADATA.getPath())) {
          folders.add(folder);
        }
      }
    }
 catch (    CoreException e) {
      log.error(e);
    }
    folders.add(recycleBin);
    return folders.toArray();
  }
 else   if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (FactoriesUtil.isPatternFile(file.getFileExtension())) {
      Pattern pattern=PatternResourceFileHelper.getInstance().findPattern(file);
      RegularExpression[] regularExp=new RegularExpression[pattern.getComponents().size()];
      int peIdx=0;
      for (      PatternComponent patCom : pattern.getComponents()) {
        regularExp[peIdx]=(RegularExpression)patCom;
        peIdx++;
      }
      return regularExp;
    }
  }
 else   if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    if (ResourceManager.isExchangeFolder(folder)) {
      try {
        if (timeoutFlag) {
          String version=CorePlugin.getDefault().getProductVersion().toString();
          return ComponentSearcher.getAvailableCategory(version).toArray();
        }
 else {
          return new String[]{"String_Node_Str"};
        }
      }
 catch (      SocketTimeoutException e) {
        timeoutFlag=false;
        return new String[]{"String_Node_Str" + e.getMessage()};
      }
catch (      Exception e) {
        timeoutFlag=false;
        return new String[]{e.getMessage()};
      }
    }
 else     if (ResourceManager.isIndicatorFolder(folder)) {
      return getIndicatorsChildren(folder);
    }
 else     if (ResourceManager.getConnectionFolder().getFullPath().isPrefixOf(folder.getFullPath())) {
      List<Object> returnList=new ArrayList<Object>();
      IPath path=folder.getFullPath().makeRelativeTo(ResourceManager.getConnectionFolder().getFullPath());
      List<IRepositoryViewObject> conList=ProxyRepositoryViewObject.fetchRepositoryViewObjectsByFolder(true,ERepositoryObjectType.METADATA_CONNECTIONS,path);
      returnList.addAll(getConnectionChildren(conList));
      for (      Object folderResource : Arrays.asList(getChildrenExceptRecBin(folder))) {
        if (folderResource instanceof IResource && ((IResource)folderResource).getType() == IResource.FOLDER) {
          returnList.add(folderResource);
        }
      }
      return returnList.toArray();
    }
 else     if (ResourceManager.getMDMConnectionFolder().getFullPath().isPrefixOf(folder.getFullPath())) {
      List<Object> returnList=new ArrayList<Object>();
      IPath path=folder.getFullPath().makeRelativeTo(ResourceManager.getMDMConnectionFolder().getFullPath());
      List<IRepositoryViewObject> conList=ProxyRepositoryViewObject.fetchRepositoryViewObjectsByFolder(true,ERepositoryObjectType.METADATA_MDMCONNECTION,path);
      returnList.addAll(getConnectionChildren(conList));
      for (      Object folderResource : Arrays.asList(getChildrenExceptRecBin(folder))) {
        if (folderResource instanceof IResource && ((IResource)folderResource).getType() == IResource.FOLDER) {
          returnList.add(folderResource);
        }
      }
      return returnList.toArray();
    }
    return getChildrenExceptRecBin(element);
  }
 else   if (element instanceof IEcosCategory) {
    return ((IEcosCategory)element).getComponent().toArray();
  }
 else   if (element instanceof IndicatorCategory) {
    return getIndicatorsChildren((IndicatorCategory)element);
  }
 else   if (element instanceof RecycleBin) {
    RecycleBin bin=(RecycleBin)element;
    return bin.getChildren();
  }
 else   if (element instanceof DQRecycleBinNode) {
    DQRecycleBinNode rbn=(DQRecycleBinNode)element;
    return getRecBinNodes(rbn).toArray();
  }
  if (needSortContainers.contains(element)) {
    return getChildrenExceptRecBin(element);
  }
  return super.getChildren(element);
}

Fixed version (ground truth):
@Override public Object[] getChildren(Object element){
  if (element instanceof IWorkspaceRoot) {
    Object currentOpenProject=null;
    for (    Object child : super.getChildren(element)) {
      if (child instanceof IProject) {
        if (((IProject)child).getName().equals(ResourceManager.getRootProjectName())) {
          currentOpenProject=child;
          break;
        }
      }
    }
    List<Object> folders=new ArrayList<Object>();
    try {
      Object[] rootFolders=new Object[0];
      rootFolders=((IProject)currentOpenProject).members(false);
      for (      Object folder : rootFolders) {
        if (folder instanceof IFolder && ((IFolder)folder).getName().startsWith(DQStructureManager.PREFIX_TDQ)) {
          if (((IFolder)folder).getName().trim().equals("String_Node_Str")) {
            continue;
          }
          folders.add(folder);
        }
        if (folder instanceof IFolder && ((IFolder)folder).getName().equals(EResourceConstant.METADATA.getPath())) {
          folders.add(folder);
        }
      }
    }
 catch (    CoreException e) {
      log.error(e);
    }
    folders.add(recycleBin);
    return folders.toArray();
  }
 else   if (element instanceof IFile) {
    IFile file=(IFile)element;
    if (FactoriesUtil.isPatternFile(file.getFileExtension())) {
      Pattern pattern=PatternResourceFileHelper.getInstance().findPattern(file);
      RegularExpression[] regularExp=new RegularExpression[pattern.getComponents().size()];
      int peIdx=0;
      for (      PatternComponent patCom : pattern.getComponents()) {
        regularExp[peIdx]=(RegularExpression)patCom;
        peIdx++;
      }
      return regularExp;
    }
  }
 else   if (element instanceof IFolder) {
    IFolder folder=(IFolder)element;
    if (ResourceManager.isExchangeFolder(folder)) {
      try {
        if (timeoutFlag) {
          String version=CorePlugin.getDefault().getProductVersion().toString();
          return ComponentSearcher.getAvailableCategory(version).toArray();
        }
 else {
          return new String[]{"String_Node_Str"};
        }
      }
 catch (      SocketTimeoutException e) {
        timeoutFlag=false;
        return new String[]{"String_Node_Str" + e.getMessage()};
      }
catch (      Exception e) {
        timeoutFlag=false;
        return new String[]{e.getMessage()};
      }
    }
 else     if (ResourceManager.isIndicatorFolder(folder)) {
      return getIndicatorsChildren(folder);
    }
 else     if (ResourceManager.getConnectionFolder().getFullPath().isPrefixOf(folder.getFullPath())) {
      List<Object> returnList=new ArrayList<Object>();
      if (ResourcesPlugin.getWorkspace().isTreeLocked()) {
        return returnList.toArray();
      }
      IPath path=folder.getFullPath().makeRelativeTo(ResourceManager.getConnectionFolder().getFullPath());
      List<IRepositoryViewObject> conList=ProxyRepositoryViewObject.fetchRepositoryViewObjectsByFolder(true,ERepositoryObjectType.METADATA_CONNECTIONS,path);
      returnList.addAll(getConnectionChildren(conList));
      for (      Object folderResource : Arrays.asList(getChildrenExceptRecBin(folder))) {
        if (folderResource instanceof IResource && ((IResource)folderResource).getType() == IResource.FOLDER) {
          returnList.add(folderResource);
        }
      }
      return returnList.toArray();
    }
 else     if (ResourceManager.getMDMConnectionFolder().getFullPath().isPrefixOf(folder.getFullPath())) {
      List<Object> returnList=new ArrayList<Object>();
      if (ResourcesPlugin.getWorkspace().isTreeLocked()) {
        return returnList.toArray();
      }
      IPath path=folder.getFullPath().makeRelativeTo(ResourceManager.getMDMConnectionFolder().getFullPath());
      List<IRepositoryViewObject> conList=ProxyRepositoryViewObject.fetchRepositoryViewObjectsByFolder(true,ERepositoryObjectType.METADATA_MDMCONNECTION,path);
      returnList.addAll(getConnectionChildren(conList));
      for (      Object folderResource : Arrays.asList(getChildrenExceptRecBin(folder))) {
        if (folderResource instanceof IResource && ((IResource)folderResource).getType() == IResource.FOLDER) {
          returnList.add(folderResource);
        }
      }
      return returnList.toArray();
    }
    return getChildrenExceptRecBin(element);
  }
 else   if (element instanceof IEcosCategory) {
    return ((IEcosCategory)element).getComponent().toArray();
  }
 else   if (element instanceof IndicatorCategory) {
    return getIndicatorsChildren((IndicatorCategory)element);
  }
 else   if (element instanceof RecycleBin) {
    RecycleBin bin=(RecycleBin)element;
    return bin.getChildren();
  }
 else   if (element instanceof DQRecycleBinNode) {
    DQRecycleBinNode rbn=(DQRecycleBinNode)element;
    return getRecBinNodes(rbn).toArray();
  }
  if (needSortContainers.contains(element)) {
    return getChildrenExceptRecBin(element);
  }
  return super.getChildren(element);
}