Skip to content

fix: restore configured timezone after pooled date parsing - #16

Open
Hanabi9248 wants to merge 1 commit into
IvorySQL:IVYC_REL_5_STABLEfrom
Hanabi9248:codex/restore-parsed-timezone
Open

Hanabi9248 wants to merge 1 commit into
IvorySQL:IVYC_REL_5_STABLEfrom
Hanabi9248:codex/restore-parsed-timezone

Conversation

@Hanabi9248

Copy link
Copy Markdown

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 PST subsequently 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):

javac --release 8 -d "$TMPDIR/dateformat-classes" common/src/main/java/com/highgo/cloud/util/toolkit/ConcurrentDateFormat.java tests/ConcurrentDateFormatTimezoneRegression.java
java -cp "$TMPDIR/dateformat-classes" ConcurrentDateFormatTimezoneRegression

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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant