Skip to content

Conversation

@pgomulka
Copy link
Contributor

Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest to shortest order. Because of this constructing just one DateTimeFormatter with appendOptional is not sufficient. Parsers have to be iterated and if the parsing fails, the next one in order should be used. In order to not degrade performance parsing should not be throw exceptions on failure. Format.parseObject was used as it only returns null when parsing failed and allows to check if full input was read.

closes #39916
backport #40100

Java-time fails parsing composite patterns when first pattern matches only the prefix of the input. It expects pattern in longest to shortest order. Because of this constructing just one DateTimeFormatter with appendOptional is not sufficient. Parsers have to be iterated and if the parsing fails, the next one in order should be used. In order to not degrade performance parsing should not be throw exceptions on failure. Format.parseObject was used as it only returns null when parsing failed and allows to check if full input was read.
 
closes elastic#39916
@pgomulka pgomulka added >bug :Core/Infra/Core Core issues without another label backport labels Mar 27, 2019
@pgomulka pgomulka self-assigned this Mar 27, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@pgomulka pgomulka merged commit 63d3fa7 into elastic:7.0 Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport >bug :Core/Infra/Core Core issues without another label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants