Created attachment 37802 [details] Pathed SheetUtil.java Our customer reported NPE error when processing excel files and since then we are patching SheetUtil class, for many years. I cannot provide Detailed error log, we cannot test it on production. When going thru code in my opinion NPE can happen in XSSF/SXSSF and i think not in HSSF Workbooks. Would like to upstream this two lines fix so we do not have to keep separate file for this: if (rt != null && rt.getString() != null) { ... } ------Original version---------------- if (cellType == CellType.STRING) { //this line number s 161 in SheetUtil.java RichTextString rt = cell.getRichStringCellValue(); String[] lines = rt.getString().split("\\n"); for (String line : lines) { String txt = line + defaultChar; AttributedString str = new AttributedString(txt); copyAttributes(font, str, 0, txt.length()); /*if (rt.numFormattingRuns() > 0) { // TODO: support rich text fragments }*/ width = getCellWidth(defaultCharWidth, colspan, style, width, str); } --------Patched version--------------------- if (cellType == CellType.STRING) { //this line number s 161 in SheetUtil.java RichTextString rt = cell.getRichStringCellValue(); if (rt != null && rt.getString() != null) { String[] lines = rt.getString().split("\\n"); for (String line : lines) { String txt = line + defaultChar; AttributedString str = new AttributedString(txt); copyAttributes(font, str, 0, txt.length()); /*if (rt.numFormattingRuns() > 0) { // TODO: support rich text fragments }*/ width = getCellWidth(defaultCharWidth, colspan, style, width, str); } } }
Thanks. Added change with r1888553
Seems this is fixed via the commit mentioned in the previous comment.