nkuprins opened a new issue, #955: URL: https://github.com/apache/fesod/issues/955
### Search before asking - [x] I searched in the [issues](https://github.com/apache/fesod/issues) and found nothing similar. ### Motivation This is about failing with a useful error, not about supporting more cell types. A cell whose `t` attribute is not one of `s`, `str`, `inlineStr`, `e`, `b`, `n` aborts the whole read with an error that names neither the cell nor the attribute: ``` java.lang.IllegalArgumentException: Type can not be null at org.apache.fesod.sheet.metadata.data.ReadCellData.<init>(ReadCellData.java:78) at org.apache.fesod.sheet.analysis.v07.handlers.CellTagHandler.startElement(CellTagHandler.java:63) ``` **Repro:** Any xlsx sheet that contains e.g. `<c r="A1" t="d"><v>2024-05-01T00:00:00</v></c>` (or `t="anything"`) **Cause:** In `CellDataTypeEnum.buildFromCellType`, a missing `t` attribute is handled - it returns `EMPTY`. But when `t` is present with a value that isn't in the map, the lookup returns `null` and nothing checks for it. That null then trips the `ReadCellData` constructor, which is where the confusing exception comes from. ### Solution Keep failing, but say what happened. In `CellTagHandler.startElement`: ```java String cellType = attributes.getValue(ExcelXmlConstants.ATTRIBUTE_T); CellDataTypeEnum type = CellDataTypeEnum.buildFromCellType(cellType); if (type == null) { throw new ExcelAnalysisException("Unsupported cell type '" + cellType + "'"); } ``` ### Alternatives Fall back to `DIRECT_STRING` when the type is `null` ### Anything else? _No response_ ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
