← Back to Pull requests

fix: honor GlobalConfiguration.locale for java.util.Date string conversion #1311

Open
unknown opened this pull request with 318 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 05, 2026 14:23 UTC
Author

<!--
Thanks very much for contributing to Apache Fesod (Incubating)! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.

Feel free to ping committers for the review!

In case of an existing issue, reference it using one of the following:

Closed: #ISSUE
Related: #ISSUE

-->

Purpose of the pull request

Closed: #1040

java.util.Date string conversion ignored GlobalConfiguration.locale: DateStringConverter called DateUtils.format(Date, ...) / parseDate(...) without a locale, so SimpleDateFormat always used the JVM default locale. Every java.time converter already passes the configured locale, so a POJO with both a Date and a LocalDateTime field got localized text for only one of them. This PR makes java.util.Date follow the same rule. Happy to adjust if maintainers consider the old split intentional.

What's changed?

  • Add DateUtils.format(Date, String, Locale) and DateUtils.parseDate(String, String, Locale) overloads. The existing signatures delegate with null, which still resolves to Locale.getDefault(Locale.Category.FORMAT), so behavior is unchanged for all current callers.

  • Key the SimpleDateFormat thread-local cache by locale first, then pattern, reusing the bounded FIFO maps already used by the DateTimeFormatter cache. Without this, two locales sharing a pattern would reuse the formatter built for the first locale.

  • Pass globalConfiguration.getLocale() from DateStringConverter in both read and write directions.

  • Add regression tests for localized write/read, cache isolation between locales, bounded cache size, and the default-locale fallback. Expected strings are generated from SimpleDateFormat with the target locale, so the tests hold on JDK 8 (JRE locale data) and JDK 9+ (CLDR).
  • No website documentation change: GlobalConfiguration.locale is already documented as affecting date/number formatting; this fix makes that statement true for java.util.Date.

    Verification

  • ./mvnw -o clean package -pl fesod-common,fesod-shaded,fesod-sheet: BUILD SUCCESS, 1807 tests, 0 failures/errors (JDK 21).

  • DateStringConverterTest + DateUtilsTest: 101 tests pass on JDK 21 and on JDK 8.

  • spotless:check and git diff --check are clean.
  • Checklist

  • I have read the Contributor Guide.

  • I have written the necessary doc or comment.

  • I have added the necessary unit tests and all cases have passed.
  • Diff: 318 lines (+238 / -80) across 3 files Reviewer: skytin1004 Review duration: 36148m
    All Vouch review confidence checks passed
    Residual risk 0.34 = Change Risk (0.64) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.64 · 318 lines diff across 3 files
    0.64
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.064
    Real PR Conversation Timeline
    1 comments
    "Review active on #1311"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 63.6% (MEDIUM) · Higher = larger blast radius
    63.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 33.9% · Safe to merge
    33.9%
    Repository