You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Numeric cells fail to read into java.time.Year ("Converter not found") #1216
I searched in the issues and found nothing similar.
Fesod version
main
JDK version
any
Operating system
any
Steps To Reproduce
// a file whose "year" column is a plain numberFilefile = newFile("year.xlsx");
try (XSSFWorkbookworkbook = newXSSFWorkbook(); OutputStreamout = newFileOutputStream(file)) {
XSSFSheetsheet = workbook.createSheet("Sheet1");
sheet.createRow(0).createCell(0).setCellValue("year");
sheet.createRow(1).createCell(0).setCellValue(2026.0);
workbook.write(out);
}
// the POJOpublicclassYearHolder {
@ExcelProperty("year")
privateYearyear;
}
// the readFesodSheet.read(file).head(YearHolder.class).sheet().doReadSync();
Current Behavior
ExcelDataConvertException: Error at row 1, column 0: Converter not found, convert NUMBER to java.time.Year
The read fails outright — a single numeric cell aborts the sheet. Date-formatted numeric cells (e.g. a real 2026-01-01 cell) fail the same way, since they are NUMBER cells at read time.
Expected Behavior
The value reads as Year.of(2026). Sibling date-like types already support numeric cells: LocalDate, LocalTime and java.util.Date each ship a ...NumberConverter, so a numeric cell reads into those fields fine — java.time.Year (added in #1087) only ships YearStringConverter, which leaves the (Year, NUMBER) key unmapped.
Anything else?
Workaround today: declare the field as String/Integer, or register a custom Converter<Year> — there is no built-in path.
Asymmetry worth noting: writing a Year field through fesod produces a STRING cell ("2026"), so fesod's own round-trip works; numeric year columns from any other source fail.
Suggested semantics for a YearNumberConverter (happy to implement):
date-formatted cell → read the serial as a date and take its year (consistent with the sibling converters);
plain numeric cell → treat the number as the year (2026 → Year.of(2026); a serial reading would give 1905, which is not what a year column means).
If the project prefers strict family consistency (serial semantics everywhere), I can implement that instead — the design call is the maintainers'.
I searched the tracker: no existing issue covers this.
The current behavior is expected because there is no built-in converter for java.time.Year yet. Therefore, this seems more like an enhancement request rather than a bug report.
Since the broader discussion about adding converters for additional java.time types is already tracked in #1017, it would be better to continue the discussion there.
With Year shipping only the STRING converter from #1087, the (Year, NUMBER) read key is unmapped, so the read takes the standard "converter not found" path — a missing converter rather than a defect. I've moved the proposal to #1017 as you suggested.
The implementation is already up as #1217 (opened earlier today, before the reclassification), now relinked and retitled as a #1017 slice rather than a bug fix. Since the work is now tracked under #1017, I'll close this issue in favor of it — easy to reopen if you'd rather keep it as the record.
Activity
bengbengbalabalabeng commentedon Oct 12, 2026
Thanks for raising this.
The current behavior is expected because there is no built-in converter for
java.time.Yearyet. Therefore, this seems more like an enhancement request rather than a bug report.Since the broader discussion about adding converters for additional
java.timetypes is already tracked in #1017, it would be better to continue the discussion there.Mikkey-f commentedon Oct 12, 2026
Agreed on both points — thanks for the steer.
With
Yearshipping only the STRING converter from #1087, the(Year, NUMBER)read key is unmapped, so the read takes the standard "converter not found" path — a missing converter rather than a defect. I've moved the proposal to #1017 as you suggested.The implementation is already up as #1217 (opened earlier today, before the reclassification), now relinked and retitled as a #1017 slice rather than a bug fix. Since the work is now tracked under #1017, I'll close this issue in favor of it — easy to reopen if you'd rather keep it as the record.