On Mon, 9 Jun 2025 22:41:21 GMT, Johannes Graham <d...@openjdk.org> wrote:
>> Sorry if I was unclear. I mean the `parse()` in the NumberFormat do not >> throw NumberFormatException/ArithmeticException, but ParseException, so if >> this piece of code need to throw something, it should be `ParseException` > > The `parse()` methods where this code gets used in `DecimalFormat` > unfortunately don't throw `ParseException`. The current calls to `getLong` > always are guarded with a call to `fitsIntoLong`, which should avoid any > exceptions actually being thrown here. So there is no parse failure as such - > instead it tries to parse it as a `double` or a `BigDecimal`. If getLong were > to be called without the guard, the exception would have come from > `Long.parseLong`, which throws a `NumberFormatException`. > > I've added a commit to follow @liach's suggestion to at least handle the > ArithmeticException so as to not introduce new exceptions into the mix. OK, sounds reasonable. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25644#discussion_r2138252488