Repository navigation
Conversation
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
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.
Summary
CommitDAOImplcreatedPreparedStatements in twoPreparedStatementCreatorcallbacks and then bound parameters on them.JdbcTemplateonly closes a statement the callback returns, so a failure while binding (for example aSQLExceptionfrom a setter, or a null commit type or timestamp) left the statement open until its connection was closed. SonarCloud reports both as blocker bugs (java:S2095, lines 43 and 119), which is what puts the project's reliability rating at E.save: the bindings are wrapped so the statement is closed before the exception is rethrown. It stays aPreparedStatementCreatorbecause the insert needs the generatedidkey.findByRefAndLimit: the callback is now aPreparedStatementSetterpassed toJdbcTemplate.query(sql, setter, rowMapper), soJdbcTemplatecreates and closes the statement itself. The SQL and the bound values are unchanged.No behaviour change on the success path.
Evidence
./gradlew :rdb:compileJavapasses on JDK 17.S2095finding it reports on the old query code is gone with this change. That standalone run does not reproduce the line 43 finding on the old code, and the pull request analysis (0 new issues) only covers changed lines, so the firstdevelopscan after merge is the check that thesavefinding closes.rdbmodule has no unit tests; the Postman collections in CI exercise commit inserts and the by-ref commit queries.