<i18n dev> RFR: 8302983: ZoneRulesProvider.registerProvider() twice will remove provider

Naoto Sato naoto at openjdk.org
Wed Feb 22 20:46:50 UTC 2023


On Tue, 21 Feb 2023 13:44:52 GMT, Madjosz <duke at openjdk.org> wrote:

> Fixes JDK-8302983 (and duplicate JDK-8302898)

Thanks for fixing this. Some comments follow.

test/jdk/java/time/test/java/time/zone/TestZoneRulesProvider.java line 43:

> 41: /**
> 42:  * @summary Tests for ZoneRulesProvider class.
> 43:  * @bug 8299571

Can be collapsed into one line

test/jdk/java/time/test/java/time/zone/TestZoneRulesProvider.java line 119:

> 117:                 return null;
> 118:             }
> 119:         }

Needs a semi-colon, otherwise would not compile.
Anyway, this inner class can be combined with the one in the test above, and made into a separate class.

test/jdk/java/time/test/java/time/zone/TestZoneRulesProvider.java line 123:

> 121:         ZoneRulesProvider.registerProvider(provider);
> 122:         assertTrue(ZoneId.getAvailableZoneIds().contains(zone), "Unexpected non-availability for " + zone);
> 123:         assertNotNull(ZoneId.of(zone), "ZoneId instance for " + zone + " should be obtainable");

If the `zone` does not exist, it will not return `null` but throw an exception. Assertion needs to be modified correctly.

test/jdk/java/time/test/java/time/zone/TestZoneRulesProvider.java line 136:

> 134:         // instantiation check
> 135:         try {
> 136:             assertNotNull(ZoneId.of(zone), "ZoneId instance for " + zone + " should still be obtainable");

Same here.

-------------

Changes requested by naoto (Reviewer).

PR: https://git.openjdk.org/jdk/pull/12690


More information about the i18n-dev mailing list