jamesfredley commented on PR #15696:
URL: https://github.com/apache/grails-core/pull/15696#issuecomment-4616418816

   Thanks @jdaugherty - good catch. The rewrite did drop the 
`InvalidVersionException`: the new `parse()` called `Integer.parseInt()` 
unguarded, so a malformed or overflowing version leaked a raw 
`NumberFormatException` instead of the explicit, side-aware diagnostic the 
plugin loading code expects.
   
   Restored in cd75a0fec7:
   
   - `compare()` now wraps the per-side `parse()` calls in `try/catch 
(NumberFormatException)` and rethrows the original `InvalidVersionException` 
messages (`Cannot compare versions, left side [..] is invalid: ..` / `right 
side`), exactly as before.
   - The milestone/RC qualifier number is now parsed eagerly inside `parse()`, 
so it runs inside the same per-side `try/catch`. Previously the only remaining 
`parseInt` for `M`/`RC` suffixes ran later in `compareQualifiers()`, outside 
any guard, and could still leak a raw `NumberFormatException` (for example 
`7.0.0-RC99999999999999999`). Unrecognised qualifiers are still treated as a 
final release and never trigger qualifier-number parsing.
   - Added `VersionComparatorSpec` regression tests asserting the explicit 
exception and the stable message prefix for both numeric-component and 
qualifier-number overflow, on the left and right sides.
   
   `./gradlew :grails-bootstrap:codeStyle :grails-core:codeStyle` and the full 
`VersionComparatorSpec` / `DefaultGrailsPluginManagerSpec` suites pass.
   


-- 
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]

Reply via email to