Repository navigation
fix: restore configured timezone after pooled date parsing - #16
Open
Hanabi9248 wants to merge 1 commit into
Open
Hanabi9248 wants to merge 1 commit into
Hanabi9248 wants to merge 1 commit into
Conversation
SimpleDateFormat may change its timezone when parsing a named zone. Restore the configured zone before returning the formatter to its pool. Add a standalone regression for named zones, numeric offsets and controls. Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parsing a named timezone can change the SimpleDateFormat instance borrowed from the pool. For example, a UTC formatter parsing
1970-01-01 00:00:00 PSTsubsequently formats the epoch in PST. Restore the configured timezone after a successful parse and before returning the instance to the pool. The parsed Date instant and existing exception path remain unchanged.Validation: compiled the complete production class and the standalone JDK-only regression with JDK 25.0.4.101 using
javac --release 8; baseline: 3 assertion failures and 3 passing controls; candidate: all 6 cases pass. Cases cover named zones with z/Z, configured UTC and GMT+02, numeric offsets, zone-free patterns, and parsing failure followed by public operations. Independent static review also completed.Run from the repository root (use a temporary output directory):
Java 8 runtime, Maven/Spring/full-service tests, concurrent-load testing, and all locale/tzdb versions were not run. Compilation on JDK 25 emitted three obsolete Java 8 target/source warnings.
Assisted-by: OpenAI gpt-6.1-sol