Program: 129566
Project: 129566
Buggy source:
private static void processContentExtensions(final CommonViewer commonViewer,boolean activeFilter,boolean activedPerspectiveFilter){
  final INavigatorContentService contentService=commonViewer.getNavigatorContentService();
  String[] visibleExtensionIds=filterRemovedNavigatorContents(contentService.getVisibleExtensionIds());
  List<String> visibleIDsForPecpective=new ArrayList<String>();
  List<String> visibleIdsForActiveFilter=new ArrayList<String>();
  if (visibleExtensionIds != null) {
    visibleIdsForActiveFilter.addAll(Arrays.asList(visibleExtensionIds));
  }
  if (activedPerspectiveFilter) {
    String perspectiveId=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getPerspective().getId();
    PerspectiveFilterHelper helper=new PerspectiveFilterHelper();
    helper.setTreeViewer(commonViewer);
    helper.setNavigatorContentService(contentService);
    helper.setActionProviderId(PerspectiveFilterActionProvider.ID);
    String[] pvExtensions=helper.getExtensionIdsToActivate(perspectiveId);
    if (pvExtensions != null && pvExtensions.length > 0) {
      visibleIDsForPecpective=Arrays.asList(pvExtensions);
    }
    visibleIdsForActiveFilter.retainAll(visibleIDsForPecpective);
  }
  String[] filteredContents=RepositoryNodeFilterHelper.getFilterByNodeValues();
  List<String> filteredContentsList=new ArrayList<String>();
  if (filteredContents != null) {
    filteredContentsList=Arrays.asList(filteredContents);
  }
  List<String> checkedExtensions=new ArrayList<String>();
  if (activeFilter) {
    for (    String id : visibleIdsForActiveFilter) {
      if (!filteredContentsList.contains(id)) {
        checkedExtensions.add(id);
      }
    }
  }
 else {
    checkedExtensions.addAll(visibleIdsForActiveFilter);
  }
  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 CommonViewer commonViewer,boolean activeFilter,boolean activedPerspectiveFilter){
  final INavigatorContentService contentService=commonViewer.getNavigatorContentService();
  String[] visibleExtensionIds=contentService.getVisibleExtensionIds();
  List<String> visibleIDsForPecpective=new ArrayList<String>();
  List<String> visibleIdsForActiveFilter=new ArrayList<String>();
  if (visibleExtensionIds != null) {
    visibleIdsForActiveFilter.addAll(Arrays.asList(visibleExtensionIds));
  }
  if (activedPerspectiveFilter) {
    String perspectiveId=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getPerspective().getId();
    PerspectiveFilterHelper helper=new PerspectiveFilterHelper();
    helper.setTreeViewer(commonViewer);
    helper.setNavigatorContentService(contentService);
    helper.setActionProviderId(PerspectiveFilterActionProvider.ID);
    String[] pvExtensions=helper.getExtensionIdsToActivate(perspectiveId);
    if (pvExtensions != null && pvExtensions.length > 0) {
      visibleIDsForPecpective=Arrays.asList(pvExtensions);
    }
    visibleIdsForActiveFilter.retainAll(visibleIDsForPecpective);
  }
  String[] filteredContents=RepositoryNodeFilterHelper.getFilterByNodeValues();
  List<String> filteredContentsList=new ArrayList<String>();
  if (filteredContents != null) {
    filteredContentsList=Arrays.asList(filteredContents);
  }
  List<String> checkedExtensions=new ArrayList<String>();
  if (activeFilter) {
    for (    String id : visibleIdsForActiveFilter) {
      if (!filteredContentsList.contains(id)) {
        checkedExtensions.add(id);
      }
    }
  }
 else {
    checkedExtensions.addAll(visibleIdsForActiveFilter);
  }
  String[] contentExtensionIdsToActivate=(String[])checkedExtensions.toArray(new String[checkedExtensions.size()]);
  UpdateActiveExtensionsOperation updateExtensions=new UpdateActiveExtensionsOperation(commonViewer,contentExtensionIdsToActivate);
  updateExtensions.execute(null,null);
}