ZoneRules.of() implies that transitionList is a superset of standardOffsetTransitionList but doesn't check that

Roman Leventov leventov.ru at gmail.com
Fri Jan 31 14:08:33 UTC 2020


java.bugs.com you mean? Not long ago I reported a similar issue about core
libs and they recommended me to write to list directly, so that's why I
wrote directly here this time.

On Fri, 31 Jan 2020 at 16:57, <naoto.sato at oracle.com> wrote:

> Hi Roman,
>
> Please file a JBS issue for this.
>
> Naoto
>
> On 1/29/20 9:56 PM, Roman Leventov wrote:
> > 1) ZoneRules.of() implies that transitionList is a superset of
> > standardOffsetTransitionList but doesn't check that. Then it's possible
> to
> > construct ZoneRules instances that don't work correctly:
> >      @Test
> >      public void zoneRulesTest() {
> >          LocalDateTime transitionDay = LocalDateTime.of(2020, 1, 1, 2,
> 0);
> >          ZoneOffsetTransition trans = ZoneOffsetTransition.of(
> >                  transitionDay,
> >                  ZoneOffset.ofHours(1),
> >                  ZoneOffset.ofHours(2)
> >          );
> >          ZoneRules rules = ZoneRules.of(ZoneOffset.ofHours(1),
> > ZoneOffset.ofHours(1),
> >                  Arrays.asList(trans),
> >                  Collections.emptyList(), Collections.emptyList());
> >
> >          Assert.assertEquals(ZoneOffset.ofHours(2), rules.getOffset(
> >                  transitionDay.plusDays(7).toInstant(ZoneOffset.UTC)));
> >      }
> >
> > 2) Unrelated issue in java-time code: in ZoneOffsetTransitionRule, there
> is
> > a typo, some variables are called "timeDefnition" (missed "i") and it
> leaks
> > to public Javadoc.
> >
>


More information about the core-libs-dev mailing list