触发场景描述 写入本地excel文件报错
触发Bug的代码 源码不方便贴,贴了简要过程代码,版本2.1.6 com.alibaba.excel.EasyExcelFactory#write(java.lang.String, java.lang.Class) 创建ExcelWriter对象 com.alibaba.excel.EasyExcelFactory#writerSheet(java.lang.String) 创建WriteSheet对象 com.alibaba.excel.ExcelWriter#write(java.util.List, com.alibaba.excel.write.metadata.WriteSheet) 写入数据
提示的异常或者没有达到的效果 写入数据报错了,本地文件为空,异常信息如下 Destroy object failed com.alibaba.excel.exception.ExcelGenerateException: Can not close IO. at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:358) at com.alibaba.excel.write.ExcelBuilderImpl.finish(ExcelBuilderImpl.java:101) at com.alibaba.excel.ExcelWriter.finish(ExcelWriter.java:328) at com.alibaba.excel.ExcelWriter.finalize(ExcelWriter.java:338) at java.lang.System$2.invokeFinalize(System.java:1270) at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:98) at java.lang.ref.Finalizer.access$100(Finalizer.java:34) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:210) Caused by: java.io.IOException: Stream Closed at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:326) at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129) at java.io.BufferedWriter.write(BufferedWriter.java:230) at java.io.Writer.write(Writer.java:157) at org.apache.poi.xssf.streaming.SheetDataWriter.writeCell(SheetDataWriter.java:238) at org.apache.poi.xssf.streaming.SheetDataWriter.writeRow(SheetDataWriter.java:159) at org.apache.poi.xssf.streaming.SXSSFSheet.flushOneRow(SXSSFSheet.java:1893) at org.apache.poi.xssf.streaming.SXSSFSheet.flushRows(SXSSFSheet.java:1871) at org.apache.poi.xssf.streaming.SXSSFSheet.flushRows(SXSSFSheet.java:1882) at org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:931) at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:314)