Skip to content

Fix NPE when Find action is unavailable in Breakpoints view#2559

Merged
elsazac merged 1 commit intoeclipse-platform:masterfrom
mx990:breakpoints-view-npe-fix
Mar 12, 2026
Merged

Fix NPE when Find action is unavailable in Breakpoints view#2559
elsazac merged 1 commit intoeclipse-platform:masterfrom
mx990:breakpoints-view-npe-fix

Conversation

@mx990
Copy link
Contributor

@mx990 mx990 commented Mar 10, 2026

The Find action may be unavailable when the focus is outside the Breakpoints view, which leads to an NPE in fillContextMenu.

This adds a null and enablement check for the Find action to resolve the problem.

Fixes #2558

The Find action may be unavailable when the focus is outside the
Breakpoints view, which leads to an NPE in fillContextMenu.

This adds a null and enablement check for the Find action to resolve
the problem.
@github-actions
Copy link
Contributor

Test Results

 1 980 files  +1 926   1 980 suites  +1 926   1h 32m 8s ⏱️ + 57m 19s
 4 750 tests +  204   4 726 ✅ +  203   24 💤 + 1  0 ❌ ±0 
14 250 runs  +2 016  14 068 ✅ +1 993  182 💤 +23  0 ❌ ±0 

Results for commit 4a502e1. ± Comparison against base commit fce9709.

This pull request removes 4543 and adds 4747 tests. Note that renamed tests count towards both.
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testAntClasspathEntryFromUrl
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testClasspathOrdering
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testClasspathOrderingDeprecated
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testGetTargets
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testGlobalProperty
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testGlobalPropertyFile
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testGlobalPropertyFileWithMinusDTakingPrecedence
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testIncludeAntRuntime
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testNoDefaultTarget
org.eclipse.ant.tests.core.tests.FrameworkTests ‑ testSettingAntHome
…
AllCompareTests AsyncExecTests ‑ testCancelOnRequeue
AllCompareTests AsyncExecTests ‑ testQueueAdd
AllCompareTests AsyncExecTests ‑ testWorker
AllCompareTests CompareFileRevisionEditorInputTest ‑ testPrepareCompareInputWithNonLocalResourceTypedElements
AllCompareTests CompareUIPluginTest ‑ testFindContentViewerDescriptorForTextType_StreamAccessor
AllCompareTests CompareUIPluginTest ‑ testFindContentViewerDescriptor_TextType_NotStreamAccessor
AllCompareTests CompareUIPluginTest ‑ testFindContentViewerDescriptor_UnknownType
AllCompareTests ContentMergeViewerTest ‑ testFFFX
AllCompareTests ContentMergeViewerTest ‑ testFFTX
AllCompareTests ContentMergeViewerTest ‑ testFFXF
…
This pull request removes 23 skipped tests and adds 24 skipped tests. Note that renamed tests count towards both.
org.eclipse.core.internal.expressions.tests.ExpressionTests ‑ testSubTypeTiming
org.eclipse.core.tests.internal.builders.BuilderCycleTest ‑ testNeedRebuild
org.eclipse.core.tests.internal.preferences.EclipsePreferencesTest ‑ _testRemoveDeletesFile
org.eclipse.core.tests.internal.preferences.PreferencesServiceTest ‑ testApplyWithTransfers
org.eclipse.core.tests.resources.CharsetTest ‑ testBug67606
org.eclipse.core.tests.resources.CharsetTest ‑ testCopyFileCopiesCharset
org.eclipse.core.tests.resources.LinkedResourceSyncMoveAndCopyTest ‑ testCopyFolderWithLinksToNonExistingLocations_withShallow
org.eclipse.core.tests.resources.ResourceAttributeTest ‑ testRefreshExecutableOnFolder
org.eclipse.core.tests.resources.refresh.RefreshJobTest ‑ testBigRecursionDeepRefresh
org.eclipse.core.tests.resources.refresh.RefreshJobTest ‑ testSmallRecursionRefresh
…
AllExpressionTests ExpressionTests ‑ testSubTypeTiming
AllTipsTests TipTest ‑ testGetImage
AutomatedResourceTests AllBuilderTests BuilderCycleTest ‑ testNeedRebuild
AutomatedResourceTests AllRefreshTests RefreshJobTest ‑ testBigRecursionDeepRefresh
AutomatedResourceTests AllRefreshTests RefreshJobTest ‑ testSmallRecursionRefresh
AutomatedResourceTests AllRefreshTests RefreshJobTest ‑ testUnrelatedRule(TestInfo)
AutomatedResourceTests AllRegressionTests Bug_032076 ‑ testFileBugOnLinux
AutomatedResourceTests AllRegressionTests Bug_032076 ‑ testFolderBugOnLinux
AutomatedResourceTests AllRegressionTests Bug_032076 ‑ testProjectBugOnLinux(Path)
AutomatedResourceTests AllRegressionTests Bug_079398 ‑ testBug79398
…

Copy link
Member

@elsazac elsazac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elsazac
Copy link
Member

elsazac commented Mar 12, 2026

Merging this now;

@elsazac elsazac merged commit 81910d7 into eclipse-platform:master Mar 12, 2026
18 checks passed
@mx990 mx990 deleted the breakpoints-view-npe-fix branch March 12, 2026 10:21
@fedejeanne
Copy link
Member

Hi @mx990, thank you for the fix!

Question: there are other usages of the method getAction(...) and also other calls with the exact same parameter here:

image

Do you know if those are safe?

@mx990
Copy link
Contributor Author

mx990 commented Mar 12, 2026

Hi @fedejeanne, thank you for pointing me to those other locations!

I was able to produce a similar exception in the Expressions view:

java.lang.NullPointerException: Cannot invoke "org.eclipse.jface.action.IAction.setImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)" because "action" is null
	at org.eclipse.debug.internal.ui.views.expression.ExpressionView.fillContextMenu(ExpressionView.java:87)
	at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:337)

I was also able to produce an error in the Variables view, which does have a null check but logs an exception:

java.lang.IllegalStateException: No action found for id: find, fGlobalActionMap: {selectAll=null, find=org.eclipse.debug.internal.ui.viewers.model.VirtualFindAction@5cca5ff3, copy=org.eclipse.ui.internal.ViewPluginAction@2fcad739, paste=null}
	at org.eclipse.debug.internal.ui.views.variables.VariablesView.fillContextMenu(VariablesView.java:1109)
	at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:337)

I was unable to produce an exception or error in either the Modules or Launch view, but it may still be sensible to also add corresponding null checks there.

@mx990
Copy link
Contributor Author

mx990 commented Mar 12, 2026

I have created an additional PR #2562 to fix the NPE in the Expressions view. Please let me know if I should also change the other locations.

@fedejeanne
Copy link
Member

Great, thank you for looking into it! No need to change the one in the Variables View on my account. @iloveeclipse since you made that change back then (e583bf6) WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPE when opening context menu in Breakpoints view

3 participants