hi,
I get a null exception when I use workbook write function with Apache POI.
My java code is

try (OutputStream out = new FileOutputStream(saveUrl)) {
    workbook.write(out);
} catch (IOException e) {
    System.err.println(e.getMessage());
}


The exception log is shown below.

java.lang.NullPointerException
at
org.apache.poi.poifs.filesystem.FilteringDirectoryNode$FilteringIterator.<init>(FilteringDirectoryNode.java:193)
at
org.apache.poi.poifs.filesystem.FilteringDirectoryNode$FilteringIterator.<init>(FilteringDirectoryNode.java:188)
at
org.apache.poi.poifs.filesystem.FilteringDirectoryNode.getEntries(FilteringDirectoryNode.java:101)
at
org.apache.poi.poifs.filesystem.FilteringDirectoryNode.iterator(FilteringDirectoryNode.java:105)
at org.apache.poi.poifs.filesystem.EntryUtils.copyNodes(EntryUtils.java:71)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1407)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1375)
at QuestionnaireExcel.writeExcelToLocal(QuestionnaireExcel.java:42)
at Main.main(Main.java:18)

The exception is the same as the url
*https://stackoverflow.com/questions/35654570/nullpointerexception-on-writing-excel-file-with-apache-poi
<https://stackoverflow.com/questions/35654570/nullpointerexception-on-writing-excel-file-with-apache-poi>.*

I searched a lot on Google but didn't find a useful solution. Could you
give me some advice to solve it ?

Thanks,
Kevin

Reply via email to