davsclaus opened a new pull request, #24710: URL: https://github.com/apache/camel/pull/24710
## Summary _Claude Code on behalf of davsclaus_ Fixes three correctness defects in camel-sql reported in [CAMEL-24048](https://issues.apache.org/jira/browse/CAMEL-24048): - **Stale `remove()` in `JdbcAggregationRepository` / `ClusteredJdbcAggregationRepository`**: `remove()` deleted with `WHERE id = ? AND version = ?` but discarded the update count. A stale version (0 rows deleted) would still insert into the completed table and report success, leading to duplicate downstream delivery. Now checks the delete count and throws `OptimisticLockingException` on mismatch, symmetric with `updateHelper()`. - **`DuplicateKeyException` race in `AbstractJdbcMessageIdRepository.add()`**: The check-then-act pattern (`queryForInt` then `insert`) allows a cross-node race where the `INSERT` hits the primary-key constraint. The `DuplicateKeyException` now returns `false` (key already exists) instead of propagating as a raw exception that fails the exchange. - **`TokenMgrError` escaping `TemplateParser`**: `parseTemplate()` only caught `ParseException` but the JavaCC lexer throws `TokenMgrError` (a `java.lang.Error`) for characters outside the token alphabet. Now caught and wrapped in `ParseRuntimeException`, consistent with `ParseException` handling. ## Test plan - [x] `JdbcAggregationRepositoryStaleRemoveTest` — verifies stale remove throws `OptimisticLockingException` - [x] `JdbcMessageIdRepositoryDuplicateInsertRaceTest` — simulates concurrent insert race deterministically via `queryForInt()` override - [x] `TemplateParserLexicalErrorTest` — verifies semicolon and backtick produce `ParseRuntimeException` not `Error` - [x] Full camel-sql test suite passes (239 tests, 0 failures) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.6 <[email protected]> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
