Amazon Ergo 1.0 · Balanced
fix-concurrent-group-access-to-prevent-nullpointerexception-keycloak
Keycloak · Java · XS · <30 lines · 3 files
The normal review, with one generalist agent. Judge: Claude Opus 5.5.
- Gold bugs found
- 1 of 2
- Comments published
- 3
- Comments matching a bug
- 1
- Comments not matching
- 2
- Cost of this PR
- $0.497
Published comments (3)
getSubGroupsCount() returns null for a concurrently deleted group — Unboxing the result can throw a `NullPointerException` because `GroupModel.getSubGroupsCount()` promises never to return null. Return `0L` when the model is gone, or update the SPI contract.
Reader thread is not joined before checking caught exceptions — An exception from the last in-flight request can be added after `assertThat(caughtExceptions, ...)` runs, letting the test pass despite the failure. Join the reader thread before asserting.
Failed group deletion leaves reader thread running indefinitely — If a group `remove()` call throws, `deletedAll` stays false and the non-daemon reader thread can hang the test JVM indefinitely. Set `deletedAll` in a `finally` block and join the reader thread.