<i18n dev> RFR: 8285844: TimeZone.getTimeZone(ZoneOffset) does not work for all ZoneOffsets and returns GMT unexpected [v2]
Stephen Colebourne
scolebourne at openjdk.java.net
Wed May 11 08:16:40 UTC 2022
On Tue, 10 May 2022 17:43:07 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> test/jdk/java/util/TimeZone/ZoneOffsetRoundTripTest.java line 43:
>>
>>> 41: private Object[][] testZoneOffsets() {
>>> 42: return new Object[][] {
>>> 43: {ZoneId.of("Z"), 0},
>>
>> I know, `ZoneId.of()` should parse this as a `ZoneOffset` and return a `ZoneOffset` instance, but maybe add also the other string variants with prefix (`ZoneId.of("UTC+00:00:01")` or `ZoneId.of("GMT+00:00:01")` as data items. Maybe also use `ZoneOffset.of()` for the plain zones to be explicit.
>
> Added them except "UTC+...", as it is not recognizable as a Custom ID.
Can the test cover `UT` prefix as well? (This is another valid prefix in `ZoneId`)
If this PR isn't meant to work with UTC prefix, can a test be added that proves it does *not* work.
ie. all these are valid in `ZoneId` - "Z", "UTC", "GMT", "UT", "UTC+01:00", "GMT+01:00", "UT+01:00" - and all should have some form of associated test.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8606
More information about the i18n-dev
mailing list