Skip to content

Fix NPE in ManagedInformerEventSource#3332

Open
Donnerbart wants to merge 3 commits intooperator-framework:mainfrom
Donnerbart:bugfix/fix-npe-in-managed-informerer-event-source
Open

Fix NPE in ManagedInformerEventSource#3332
Donnerbart wants to merge 3 commits intooperator-framework:mainfrom
Donnerbart:bugfix/fix-npe-in-managed-informerer-event-source

Conversation

@Donnerbart
Copy link
Copy Markdown
Contributor

Fixes #3331

…emoval

Signed-off-by: David Sondermann <david.sondermann@hivemq.com>
Copilot AI review requested due to automatic review settings May 4, 2026 12:48
@openshift-ci openshift-ci Bot requested review from csviri and metacosm May 4, 2026 12:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a null-handling gap in the informer-managed update path where Fabric8 edit() can return null (notably on HTTP 404), which previously could lead to an NPE when updating the temporary resource cache. This aligns behavior with the reported issue #3331 (“patch target already deleted”).

Changes:

  • Add a null guard in ManagedInformerEventSource.eventFilteringUpdateAndCacheResource to skip cache update when the update operation returns null.
  • Add regression tests covering null returns from the update method at both the informer event source layer and via ResourceOperations.removeFinalizer.
  • Minor test refactors/formatting adjustments.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSource.java Adds null-guard around cache update after updateMethod.apply(...); also changes manager() visibility.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSourceTest.java Adds regression test ensuring eventFilteringUpdateAndCacheResource cleanly propagates null.
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/reconciler/ResourceOperationsTest.java Adds integration-style regression test for removeFinalizer when underlying patch/edit returns null.

Donnerbart added 2 commits May 4, 2026 16:01
…atch target is deleted

Signed-off-by: David Sondermann <david.sondermann@hivemq.com>
…of the returned class

Signed-off-by: David Sondermann <david.sondermann@hivemq.com>
@Donnerbart Donnerbart force-pushed the bugfix/fix-npe-in-managed-informerer-event-source branch from 396094f to d103e18 Compare May 4, 2026 14:01
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 in ManagedInformerEventSource.eventFilteringUpdateAndCacheResource when patch target was already deleted on the API server

2 participants