Fix NPE in ManagedInformerEventSource#3332
Open
Donnerbart wants to merge 3 commits intooperator-framework:mainfrom
Open
Fix NPE in ManagedInformerEventSource#3332Donnerbart wants to merge 3 commits intooperator-framework:mainfrom
Donnerbart wants to merge 3 commits intooperator-framework:mainfrom
Conversation
…emoval Signed-off-by: David Sondermann <david.sondermann@hivemq.com>
Contributor
There was a problem hiding this comment.
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.eventFilteringUpdateAndCacheResourceto skip cache update when the update operation returnsnull. - Add regression tests covering
nullreturns from the update method at both the informer event source layer and viaResourceOperations.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. |
…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>
396094f to
d103e18
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3331