Program: 129688
Project: 129688
Buggy source:
private static void processContentExtensions(final ICommonActionExtensionSite commonActionSite,boolean activedFilter){
  final CommonViewer commonViewer=(CommonViewer)commonActionSite.getStructuredViewer();
  final INavigatorContentService contentService=commonActionSite.getContentService();
  final INavigatorContentDescriptor[] visibleExtensions=contentService.getVisibleExtensions();
  String[] filteredContents=RepositoryViewPlugin.getDefault().getPreferenceValues(IRepositoryPrefConstants.FILTER_BY_NODE);
  List<String> filteredContentsList=new ArrayList<String>();
  if (filteredContents != null) {
    filteredContentsList=Arrays.asList(filteredContents);
  }
  List<String> checkedExtensions=new ArrayList<String>();
  for (int i=0; i < visibleExtensions.length; i++) {
    String id=visibleExtensions[i].getId();
    if (!activedFilter || activedFilter && !filteredContentsList.contains(id)) {
      checkedExtensions.add(id);
    }
  }
  String[] contentExtensionIdsToActivate=(String[])checkedExtensions.toArray(new String[checkedExtensions.size()]);
  UpdateActiveExtensionsOperation updateExtensions=new UpdateActiveExtensionsOperation(commonViewer,contentExtensionIdsToActivate);
  updateExtensions.execute(null,null);
}

Fixed version (ground truth):
private static void processContentExtensions(final ICommonActionExtensionSite commonActionSite,boolean activeFilter,boolean activedPerspectiveFilter){
  final CommonViewer commonViewer=(CommonViewer)commonActionSite.getStructuredViewer();
  final INavigatorContentService contentService=commonActionSite.getContentService();
  final INavigatorContentDescriptor[] visibleExtensions=contentService.getVisibleExtensions();
  List<String> visibleIDsForPecpective=new ArrayList<String>();
  List<String> visibleIdsForActiveFilter=new ArrayList<String>();
  for (  INavigatorContentDescriptor nd : visibleExtensions) {
    visibleIdsForActiveFilter.add(nd.getId());
  }
  if (activedPerspectiveFilter) {
    String perspectiveId=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getPerspective().getId();
    PerspectiveFilterActionProvider pvFilter=new PerspectiveFilterActionProvider();
    pvFilter.getHelper().setTreeViewer(commonViewer);
    pvFilter.getHelper().setNavigatorContentService(contentService);
    pvFilter.getHelper().setActionProviderId(pvFilter.ID);
    String[] pvExtensions=pvFilter.getHelper().getExtensionIdsToActivate(perspectiveId);
    if (pvExtensions != null && pvExtensions.length > 0) {
      visibleIDsForPecpective=Arrays.asList(pvExtensions);
    }
    visibleIdsForActiveFilter.retainAll(visibleIDsForPecpective);
  }
  String[] filteredContents=RepositoryViewPlugin.getDefault().getPreferenceValues(IRepositoryPrefConstants.FILTER_BY_NODE);
  List<String> filteredContentsList=new ArrayList<String>();
  if (filteredContents != null) {
    filteredContentsList=Arrays.asList(filteredContents);
  }
  List<String> checkedExtensions=new ArrayList<String>();
  for (  String id : visibleIdsForActiveFilter) {
    if (!activedPerspectiveFilter || (activedPerspectiveFilter && !filteredContentsList.contains(id))) {
      checkedExtensions.add(id);
    }
  }
  String[] contentExtensionIdsToActivate=(String[])checkedExtensions.toArray(new String[checkedExtensions.size()]);
  UpdateActiveExtensionsOperation updateExtensions=new UpdateActiveExtensionsOperation(commonViewer,contentExtensionIdsToActivate);
  updateExtensions.execute(null,null);
}