Skip to content

Replaced SimpleDateFormat with DateTimeFormatter wherever thread-critical - #208

Merged
tonygermano merged 1 commit into
OpenIntegrationEngine:mainfrom
NicoPiel:bug/replace-simpledateformat
Nov 29, 2025
Merged

Replaced SimpleDateFormat with DateTimeFormatter wherever thread-critical#208
tonygermano merged 1 commit into
OpenIntegrationEngine:mainfrom
NicoPiel:bug/replace-simpledateformat

Conversation

@NicoPiel

@NicoPielNicoPiel commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

Solves #207

@mgaffiganmgaffigan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with changing:

  • server/src/com/mirth/connect/client/core/api/providers/CalendarParamConverterProvider.java
  • server/src/com/mirth/connect/plugins/serverlog/ServerLogItem.java

but the others are all allocated on the stack - and have no possibility for cross-thread use. Changing DateUtil in particular seems unnecessarily risky.

Also, is there a reason we're jumping to Apache FastDateFormat instead of Java 8 DateTimeFormatter?

@NicoPiel
NicoPielforce-pushed the bug/replace-simpledateformat branch from 9b1257e to 614b02eCompareNovember 20, 2025 00:18
@NicoPielNicoPiel changed the title Replaced SimpleDateFormat with FastDateFormat wherever possibleReplaced SimpleDateFormat with DateTimeFormatter wherever thread-criticalNov 20, 2025
@NicoPiel
NicoPielforce-pushed the bug/replace-simpledateformat branch from 2ce92e1 to 75644deCompareNovember 20, 2025 14:15
@jonbartels

Copy link
Copy Markdown
Contributor

I agree with Mitch

Also, is there a reason we're jumping to Apache FastDateFormat instead of Java 8 DateTimeFormatter?

The core Java DateTimeFormatter is rock solid.

@NicoPiel

Copy link
Copy Markdown
ContributorAuthor

I agree with Mitch

Also, is there a reason we're jumping to Apache FastDateFormat instead of Java 8 DateTimeFormatter?

The core Java DateTimeFormatter is rock solid.

That's why it's implemented :)

@NicoPiel

Copy link
Copy Markdown
ContributorAuthor

@mgaffigan Any more thoughts on this?

jonbartels
jonbartels previously approved these changes Nov 24, 2025

@mgaffiganmgaffigan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please omit the unused import, then I'll be good.

Comment threadserver/src/com/mirth/connect/plugins/serverlog/ServerLogItem.java Outdated
@NicoPiel

Copy link
Copy Markdown
ContributorAuthor

Please omit the unused import, then I'll be good.

Done.

mgaffigan
mgaffigan previously approved these changes Nov 24, 2025
@NicoPiel
NicoPielforce-pushed the bug/replace-simpledateformat branch from 5fc7fb6 to d2b3e14CompareNovember 24, 2025 18:59
jonbartels
jonbartels previously approved these changes Nov 24, 2025
@NicoPiel
NicoPiel dismissed stale reviews from jonbartels and mgaffigan via 47222bbNovember 25, 2025 18:30
mgaffigan
mgaffigan previously approved these changes Nov 25, 2025
tonygermano
tonygermano previously approved these changes Nov 25, 2025
@tonygermanotonygermano linked an issue Nov 26, 2025 that may be closed by this pull request
@kayyagari
kayyagari self-requested a review November 26, 2025 04:19
kayyagari
kayyagari previously approved these changes Nov 26, 2025
@kayyagari
kayyagari self-requested a review November 26, 2025 16:12
kayyagari
kayyagari previously approved these changes Nov 26, 2025
mgaffigan
mgaffigan previously approved these changes Nov 26, 2025
@NicoPiel
NicoPielforce-pushed the bug/replace-simpledateformat branch 3 times, most recently from c2f5445 to a9aae13CompareNovember 28, 2025 15:29
@NicoPiel
NicoPiel dismissed stale reviews from kayyagari and mgaffigan via a0fc467November 28, 2025 15:30
@NicoPiel
NicoPielforce-pushed the bug/replace-simpledateformat branch from a9aae13 to a0fc467CompareNovember 28, 2025 15:30
Replace usages of the non-thread-safe date formatter with java.time's DateTimeFormatter and related APIs to improve thread-safety and correctness when parsing/formatting dates and time zones. Update calendar parameter conversion to use ZonedDateTime/Instant and adapt log timestamp formatting to use DateTimeFormatter.
Removes unused imports and modernizes date handling to avoid concurrency issues introduced by SimpleDateFormat.
Collectively decided to use `DateTimeFormatter` instead of `FastDateTime`.
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
@NicoPiel
NicoPielforce-pushed the bug/replace-simpledateformat branch from a0fc467 to fa8957dCompareNovember 28, 2025 15:31
@kayyagari
kayyagari self-requested a review November 29, 2025 03:09
@tonygermano
tonygermano merged commit fa8957d into OpenIntegrationEngine:mainNov 29, 2025
2 checks passed
@NicoPiel
NicoPiel deleted the bug/replace-simpledateformat branch November 29, 2025 14:43
@tonygermanotonygermano added this to the Next Release milestone Dec 2, 2025
Sign up for freeto 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.

[BUG] SimpleDateFormat is not thread-safe

5 participants

@NicoPiel@jonbartels@kayyagari@mgaffigan@tonygermano