Skip to content

Fix thread safety: replace shared Matcher and SimpleDateFormat instances #1929

Open
dpol1 wants to merge 1 commit into
mainfrom
thread-safety
Open

Fix thread safety: replace shared Matcher and SimpleDateFormat instances #1929
dpol1 wants to merge 1 commit into
mainfrom
thread-safety

Conversation

@dpol1
Copy link
Copy Markdown
Member

@dpol1 dpol1 commented Jun 4, 2026

SimpleDateFormat and shared Matcher instances are not thread-safe.
In a multi-threaded Storm topology this can cause silent data corruption
or incorrect results under concurrent load.

  • RefreshTag: replace static shared Matcher with a Pattern constant
    and a per-call Matcher instance
  • FileResponse: replace SimpleDateFormat with DateTimeFormatter
    (also use try-with-resources for FileInputStream in the same class)
  • CookieConverter: replace SimpleDateFormat with DateUtils.parseDate();
    also fix a duplicate setExpiryDate() call and add a null guard on the
    parsed date

…ances

- RefreshTag: replace static shared Matcher with Pattern + per-call Matcher
- FileResponse: replace SimpleDateFormat with DateTimeFormatter; use
  try-with-resources for FileInputStream
- CookieConverter: replace SimpleDateFormat with DateUtils.parseDate();
  fix duplicate setExpiryDate() call; add null guard on parsed date
@rzo1 rzo1 added this to the 3.6.1 milestone Jun 4, 2026
@dpol1 dpol1 requested a review from jnioche June 4, 2026 14:13
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.

2 participants