NIFI-14572 Fix time offset issue in DateTimeAdapter#unmarshal#11129
NIFI-14572 Fix time offset issue in DateTimeAdapter#unmarshal#11129superdachuan wants to merge 3 commits intoapache:mainfrom
Conversation
53f1a63 to
d28fbdf
Compare
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for working on this issue @superdachuan.
The functional approach looks good, aligning with TimestampAdapter as described.
I noted several recommendations on the test class, which could use some refinement to ensure expected behavior.
3017f57 to
9dfb3e0
Compare
|
@exceptionfactory Thanks for the review and helpful suggestions. I updated the tests accordingly. My original intent in combining I had originally avoided temporarily switching the default time zone because I was concerned about affecting other tests. After reviewing similar patterns in the codebase, I updated this test to verify behavior across multiple time zones directly. Thanks again. |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @superdachuan. Unfortunately, the new testing approach goes too far in the direction of complexity, and implementing a custom ClassLoader is far more than needed for testing this class. Please revert the change and pursue a simpler approach.
|
Thanks for the feedback @exceptionfactory . I reverted the custom ClassLoader-based test change and simplified the approach. In the updated revision, I removed With that change in place, the tests can switch the default time zone directly without relying on class reloading or a custom ClassLoader. |
6e1f542 to
97a0ccf
Compare
Align DateTimeAdapter#unmarshal with TimestampAdapter by replacing ZonedDateTime with LocalDateTime to avoid timezone ambiguity (e.g., CST)
97a0ccf to
9e7daa0
Compare
Summary
NIFI-14572
This PR fixes a time offset issue in
DateTimeAdapter#unmarshal. The current implementation usesZonedDateTime, which can lead to ambiguous parsing of time zone abbreviations such asCST, resulting in incorrect offsets. This change aligns the implementation withTimestampAdapterby replacingZonedDateTimewithLocalDateTimeand converting it using the system default time zone, avoiding such ambiguity. Although this issue may appear related to NIFI-14581, they are not the same problem and have different root causes: NIFI-14581 is caused by inconsistencies between the time zone ID returned byTimezoneAdapterand the server's default locale, whereas this PR addresses ambiguity in parsing time zone abbreviations. Therefore, this change focuses specifically on fixing the time offset issue inDateTimeAdapterand does not address NIFI-14581.Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000VerifiedstatusPull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
./mvnw clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation