触发场景描述 根据模板写入excel,指定写入的SheetName在模板中不存在时直接抛出NullPointerException 。 触发Bug的代码
WriteSheet writeSheet = EasyExcel.writerSheet("SheetName").build();
提示的异常或者没有达到的效果 Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "analysisCellList" is null at com.alibaba.excel.write.executor.ExcelWriteFillExecutor.doFill(ExcelWriteFillExecutor.java:179) at com.alibaba.excel.write.executor.ExcelWriteFillExecutor.fill(ExcelWriteFillExecutor.java:106) at com.alibaba.excel.write.ExcelBuilderImpl.fill(ExcelBuilderImpl.java:78) at com.alibaba.excel.ExcelWriter.fill(ExcelWriter.java:185)