davsclaus opened a new pull request, #25679: URL: https://github.com/apache/camel/pull/25679
Fixes [CAMEL-24469](https://issues.apache.org/jira/browse/CAMEL-24469) on `main`. Companion to the branch-specific fix in #25678 (`camel-4.22.x`). ## Why also on main `main` carries the **identical buggy code**. It does not currently crash there only because main's version is a `.0` SNAPSHOT (`4.23.0-SNAPSHOT`), for which the broken string comparison happens to sort correctly. The latent bug resurfaces the moment main moves to a `.1` SNAPSHOT or the next `camel-4.23.x` maintenance branch is cut. Landing the fix on main keeps it the canonical source and prevents the regression from reappearing on future branch cuts. ## Root cause `PluginHelper.versionCheck` stripped `-SNAPSHOT` from the current `version` but **not** from the plugin `firstVersion`, then compared with the string-based `VersionHelper.compare`: ``` compare("4.22.1", "4.22.1-SNAPSHOT") -> "042201" vs "04221-SNAPSHOT" -> position 4: '0' (48) < '1' (49) -> negative -> isGE == false ``` A plugin whose `firstVersion` equals the current SNAPSHOT was rejected, invoking `main.quit(1)` — `System.exit` on the real `CamelJBangMain`, which crashes the surefire fork running `PluginHelperTest`. ## Fix Strip `-SNAPSHOT` from `firstVersion` as well before comparing. Added regression tests (`testVersionCheckAcceptsSameSnapshotVersion`, `testVersionCheckRejectsOlderVersion`). ## Verification `PluginHelperTest` — 11 tests pass on JDK 21. --- _Fix prepared by Claude Code on behalf of davsclaus_ -- 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]
