Replaced SimpleDateFormat with DateTimeFormatter wherever thread-critical#208
Conversation
mgaffigan
left a comment
There was a problem hiding this comment.
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?
9b1257e to
614b02e
Compare
2ce92e1 to
75644de
Compare
|
I agree with Mitch
The core Java DateTimeFormatter is rock solid. |
That's why it's implemented :) |
|
@mgaffigan Any more thoughts on this? |
mgaffigan
left a comment
There was a problem hiding this comment.
Please omit the unused import, then I'll be good.
server/src/com/mirth/connect/plugins/serverlog/ServerLogItem.java
Outdated
Show resolved
Hide resolved
server/src/com/mirth/connect/client/core/api/providers/CalendarParamConverterProvider.java
Show resolved
Hide resolved
Done. |
5fc7fb6 to
d2b3e14
Compare
server/src/com/mirth/connect/client/core/api/providers/CalendarParamConverterProvider.java
Outdated
Show resolved
Hide resolved
f91ae66
c2f5445 to
a9aae13
Compare
a9aae13 to
a0fc467
Compare
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>
a0fc467 to
fa8957d
Compare
Solves #207