Repository navigation
Conversation
|
Added one commit to apply the same CSV fallback to
Verification: targeted 11 + 3 passed; full suite 60 + 1,806, 0 failures; spotless and javadoc pass. |
Revert the string-converter system-zone fallback and write ISO zoned text for CSV instead, keeping strict parsing as requested in apache#1020.
|
Correction to my previous comment: I reverted the string-converter fallback and fixed the CSV path on the write side instead.
The previous fallback commit is still in the branch history but is reverted by the new commit; the final tree keeps parsing strict. The new commit also adds round-trip coverage: CSV preserves the zone, XLSX/XLS read back the local date-time with the JVM default zone. Verification: targeted |
…me-converters # Conflicts: # fesod-sheet/src/main/java/org/apache/fesod/sheet/converters/DefaultConverterLoader.java
Purpose of the pull request
Related: #1017 (java.time.ZonedDateTime slice).
java.time.ZonedDateTimeis on the #1017 list of missing converters. Without it, aZonedDateTimefield fails on read and write withCan not find 'Converter' support class ZonedDateTime, while the sibling date-time types (LocalDateTime,OffsetDateTime,Instant) are supported. This adds the STRING/NUMBER/DATE converters for it.Supersedes #1020. The initial implementation and tests are @alexsmolya's work from that PR (the first commit keeps his authorship). This branch rebases that work onto current main, moves the tests to the
converters/zoneddatetimepackage used by the other families, and addresses the review feedback on #1020.What's changed?
converters/zoneddatetimepackage, registered inDefaultConverterLoader:ZonedDateTimeStringConverter(read + write): usesISO_ZONED_DATE_TIMEwhen no pattern is configured, otherwise the@DateTimeFormatpattern through the shared bounded formatter cache inDateUtils. Reads are strict: text without a zone is rejected instead of falling back to the server zone.ZonedDateTimeNumberConverter(read + write): reads the Excel serial viaDateUtils.getLocalDateTime(..., isDate1904(...))and returnsnullfor invalid serials (previously an NPE); writesDateUtil.getExcelDate.ZonedDateTimeDateConverter(write only, DATE cell): normalizes an empty@DateTimeFormattonull, so the defaultyyyy-MM-dd HH:mm:ssformat applies instead of writing a format-less DATE cell.DateUtils: addsparseZonedDateTime(String, String, Locale)andformat(ZonedDateTime, String, Locale)that use the existing cache (getCacheDateTimeFormatstays private).Verification
nullguard inZonedDateTimeNumberConverter→numberConverterReturnsNullForInvalidExcelDatefails with an NPE (LocalDateTime.atZone);Can not find 'Converter' support class ZonedDateTime.ZonedDateTimeConverterTest10/10,ZonedDateTimeRoundTripTest3/3 (XLSX, XLS, CSV),DateUtilsTest+1.mvn clean package -B -Dmaven.test.skip=false -pl fesod-common,fesod-shaded,fesod-sheet: 1,862 tests, 0 failures.spotless:checkandjavadoc:javadocpass.Notes
Asia/Shanghai) and clear the shared formatter cache after each test, per the latest review on feat: add ZonedDateTime converters #1020.Checklist