Program: 129648
Project: 129648
Buggy source:
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();
    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 ICommonActionExtensionSite commonActionSite,boolean activeFilter,boolean activedPerspectiveFilter){
  final CommonViewer commonViewer=(CommonViewer)commonActionSite.getStructuredViewer();
  final INavigatorContentService contentService=commonActionSite.getContentService();
  String[] visibleExtensionIds=filterRemovedNavigatorContents(contentService.getVisibleExtensionIds());
  List<String> visibleIDsForPecpective=new ArrayList<String>();
  List<String> visibleIdsForActiveFilter=new ArrayList<String>();
  for (  String id : visibleExtensionIds) {
    visibleIdsForActiveFilter.add(id);
  }
  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);
}