Skip to content

Commit 19d70f2

Browse files
committed
fix: avoid NPE in ConfiguredController.close if manager is not set
Note that this shouldn't happen during normal execution but can happen during tests.
1 parent 0831be1 commit 19d70f2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/ConfiguredController.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ private boolean failOnMissingCurrentNS() {
221221

222222
@Override
223223
public void close() throws IOException {
224-
manager.close();
224+
if (manager != null) {
225+
manager.close();
226+
}
225227
}
226228
}

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/internal/CustomResourceEventSourceTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ private static class TestConfiguration implements
118118

119119
final ConfigurationService service = mock(ConfigurationService.class);
120120
final boolean generationAware;
121+
121122
public TestConfiguration(boolean generationAware) {
122123
when(service.getObjectMapper()).thenReturn(ConfigurationService.OBJECT_MAPPER);
123124
this.generationAware = generationAware;

0 commit comments

Comments
 (0)