Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366991

Summary: [Markers] NPE in MarkerGroup.addEntry() by opening the Problems view via "Ctrl+3"
Product: [Eclipse Project] Platform Reporter: Andrey Loskutov <loskutov>
Component: IDEAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Michael_Rennie, ob1.eclipse, pwebster
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard: stalebug

Description Andrey Loskutov CLA 2011-12-16 17:05:07 EST
Build Identifier: 3.3, 3.4, 3.5, 3.6, 3.7, 3.8 M4

AS IS:
In FindBugs Eclipse plugin we contribute our own problem markers. So far so good. BUT as soon as we try to contribute our "Groups" to the markerSupport extension point, we get an NPE at:

!ENTRY org.eclipse.ui.workbench 4 0 2011-12-16 22:31:52.353
!MESSAGE Unable to create view ID org.eclipse.ui.views.ProblemView: An unexpected exception was thrown.
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.views.markers.internal.MarkerGroup.addEntry(MarkerGroup.java:452)
	at org.eclipse.ui.views.markers.internal.MarkerGroup.mapAttribute(MarkerGroup.java:594)
	at org.eclipse.ui.views.markers.internal.MarkerSupportRegistry.processAttributeMappings(MarkerSupportRegistry.java:490)
	at org.eclipse.ui.views.markers.internal.MarkerSupportRegistry.postProcessExtensions(MarkerSupportRegistry.java:400)
	at org.eclipse.ui.views.markers.internal.MarkerSupportRegistry.<init>(MarkerSupportRegistry.java:222)
	at org.eclipse.ui.views.markers.internal.MarkerSupportRegistry.getInstance(MarkerSupportRegistry.java:178)
	at org.eclipse.ui.internal.views.markers.ExtendedMarkersView.init(ExtendedMarkersView.java:947)
	at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:343)
	at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)

The problem exists since ever (I can trace it down to 3.3.2) and I wonder myself why I didn't reported it yet.

The problem can be reproduced:
download the latest version of FindBugs Eclipse plugin from [1], unzip it to /dropins and before starting Eclipse, uncomment the block below in the plugin.xml:


   <extension
         point="org.eclipse.ui.ide.markerSupport">
      <markerAttributeGrouping
            attribute="priority"
            defaultGroupingEntry="org.eclipse.jdt.ui.category.potential"
            markerType="edu.umd.cs.findbugs.plugin.eclipse.findbugsMarker">
         <markerAttributeMapping

               markerGroupingEntry="fb.low"
               value="0">
         </markerAttributeMapping>
         <markerAttributeMapping
               markerGroupingEntry="fb.normal"
               value="1">
         </markerAttributeMapping>
         <markerAttributeMapping
               markerGroupingEntry="fb.high"
               value="2">
         </markerAttributeMapping>
      </markerAttributeGrouping>
      <markerGroupingEntry
            id="fb.high"
            label="FindBugs Warnings (High Confidence)"
            markerGrouping="org.eclipse.jdt.ui.java_marker_category"
            priority="79">
      </markerGroupingEntry>
      <markerGroupingEntry
            id="fb.normal"
            label="FindBugs Warnings (Normal Confidence)"
            markerGrouping="org.eclipse.jdt.ui.java_marker_category"
            priority="75">
      </markerGroupingEntry>
      <markerGroupingEntry
            id="fb.low"
            label="FindBugs Warnings (Low Confidence)"
            markerGrouping="org.eclipse.jdt.ui.java_marker_category"
            priority="71">
      </markerGroupingEntry>
   </extension>

Once plugin is installed, start Eclipse, run FindBugs analysis on any Java project (it will find for sure at least one warning), go to the Problems view (if it can be opened), change the "Group By" to "Java Problem Type", verify that there is at least one "FindBugs Warnings ..." group shown.

Now close the view (this is important!) and restart Eclipse. The view settings is now saved. On the next restart if you will do "Ctrl+3" + "Problems", Problems view fail with NPE on opening. 

If you repeat the same steps BUT do NOT close the Problems view before closing Eclipse, NPE will not occur after restart.

[1] http://prdownloads.sourceforge.net/findbugs/edu.umd.cs.findbugs.plugin.eclipse_2.0.0.20111211.zip?download
or 
http://findbugs.sourceforge.net/downloads.html

Reproducible: Always
Comment 1 Lars Vogel CLA 2019-11-27 07:35:38 EST
This bug hasn't had any activity in quite some time. Maybe the problem got
resolved, was a duplicate of something else, or became less pressing for some
reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it.
The information can be, for example, that the problem still occurs, that you
still want the feature, that more information is needed, or that the bug is
(for whatever reason) no longer relevant.

If the bug is still relevant, please remove the stalebug whiteboard tag.