[threeten-dev] ZoneIdPrinterParser.parser and SubstringTree

Stephen Colebourne scolebourne at joda.org
Tue Dec 11 00:29:30 PST 2012


On 11 December 2012 06:19, Xueming Shen <xueming.shen at oracle.com> wrote:
> SubstringTree + zid parsing code currently only works with the case that the
> ZondID is
> the last piece of the input text (I added back the TestZoneIdParser with a
> new startMatch).

I have a memory that the last time I looked at this it didn't seem
quite right. Thanks for fixing and for the optimisation. Patch looks
OK.

Stephen


> It appears there are at least two issues here.
>
> (1) L#2574, the last matched zoneid will get lost if there are more chars in
> the input, which
> will fail the last try tree.get(...).
>
> (2) There are two possible reasons tree.get(...) returns null. A mismatch OR
> the end of the branch
> reached (longest zid found, no more try).
>
> Here is the webrev to fix them. I also change the substringMap to only be
> initialized (create
> the HashMap) if needed. My test suggests only less than 40 out of 500+ nodes
> (from current
> zid list) are parent node that really needs a HashaMap. This might not be a
> big issue given the
> the zid is mostly likely a one-time initialization. But we will probably use
> this for the ZoneText
> parser as well, in which there will be one for each locale, each style...
>
> http://cr.openjdk.java.net/~sherman/jdk8_threeten/zid_parser
>
> -Sherman
>
>


More information about the threeten-dev mailing list