leehaut opened a new pull request, #8639:
URL: https://github.com/apache/hop/pull/8639
## Summary
String-to-number conversion uses `DecimalFormat`, which accepts only the
locale's negative prefix. JSON input, data grids, and calculator constants use
an ASCII hyphen-minus (`-`). In locales whose prefix is not that character,
parsing `-2` stops on the first character:
```text
couldn't convert String to number : non-numeric character found at position
1 for value [-2]
```
This matches the failure in #8593 for both JSON Input and Calculator. On
Java 21 the same pattern fails for `nb-NO`, `sv-SE`, and `fi-FI` (negative
prefix `U+2212`) and for `ar-SA` (a bidi mark before the hyphen). `en-US` and
`zh-CN` accept `-`.
Hop GUI calls `Locale.setDefault(LanguageChoice...)` at startup, and a beta
language such as `no_NO` falls back to `en-US`, so the GUI converts the value.
`hop-run` does not set the locale, so a workflow started from Task Scheduler
keeps the Windows regional format. The issue report does not name that format.
The conversion failure above is what this change fixes; please confirm that the
reporter's regional format is one of these locales.
`ValueMetaBase` now retries the parse once when the first character is
rejected, rewriting a leading ASCII `-` or Unicode minus (`U+2212`) to the
format's negative prefix. Integer, Number, and BigNumber conversion all use
that path. Output formatting is unchanged.
## Test plan
- [x] `ValueMetaBaseLocaleMinusTest` covers `nb-NO`, `sv-SE`, `fi-FI`, and
`ar-SA` for `-2`, `2`, and `U+2212`, and still rejects `x` and `-2x`
- [x] From a US Windows machine, run a pipeline whose Data Grid integer
field contains `-2`:
```bat
set HOP_OPTIONS=-Xmx2048m -Duser.language=nb -Duser.country=NO
hop-run.bat -f negative-integer.hpl -r local
```
`2` and `-2` should both be converted.
- [x] Reporter: rerun the original workflow through Task Scheduler and note
the Windows regional format, or `user.language` and `user.country`.
--
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]