Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a potential failure in the API export CRD process by introducing robust null and empty collection checks across key user-related services. The changes prevent Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a failure in the API export to CRD functionality. The core of the fix is adding a null check in ApiCRDExportDomainServiceImpl to prevent a NullPointerException when a user associated with a membership cannot be found. Additionally, the PR introduces defensive checks in JdbcUserRepository and UserCrudServiceImpl to gracefully handle null or empty collections of user IDs, which is a good practice. Corresponding unit tests have been added to validate this new behavior. The changes are sound and effectively resolve the reported issue. I have one suggestion to refactor the new tests for better conciseness.
...-service/src/test/java/io/gravitee/apim/infra/crud_service/user/UserCrudServiceImplTest.java
Outdated
Show resolved
Hide resolved
b4151e7 to
e73003b
Compare
Issue
https://gravitee.atlassian.net/browse/APIM-12926
Description
JdbcUserRepository.javafindByIds(Collection<String> ids), returnCollections.emptySet()whenidsis null or empty to avoid invalid SQLWHERE u.id IN ().UserCrudServiceImpl.javafindBaseUsersByIds(List<String> userIds), returnSet.of()whenuserIdsis null or empty so the repository is not called with an empty list.ApiCRDExportDomainServiceImpl.javasetMembersSourceId(), only setsourceId/sourcewhen a user is found (user != null) so group-only members without a user record do not cause NPE.Screen.Recording.2026-03-18.at.10.20.59.PM.mov