If I import an Excel document with the sstCacheSize set to a positive value I get a NullPointerException.
java.lang.NullPointerException: null at com.monitorjbl.xlsx.sst.FileBackedList.writeToFile(FileBackedList.java:74) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.sst.FileBackedList.add(FileBackedList.java:52) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.sst.BufferedStringsTable.readFrom(BufferedStringsTable.java:43) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.sst.BufferedStringsTable.<init>(BufferedStringsTable.java:31) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.sst.BufferedStringsTable.getSharedStringsTable(BufferedStringsTable.java:26) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.impl.StreamingWorkbookReader.init(StreamingWorkbookReader.java:120) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.impl.StreamingWorkbookReader.init(StreamingWorkbookReader.java:91) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.StreamingReader$Builder.open(StreamingReader.java:251) ~[xlsx-streamer-2.1.0.jar:na]
This happens because BufferedStringsTable.parseCT_Rst returns a NULL value which is then passed into the FileBackedList.add method which causes an error.
This could be fixed by performing a NULL check before adding it to the list.
For example:
Version
2.1.0
If I import an Excel document with the
sstCacheSize
set to a positive value I get a NullPointerException.java.lang.NullPointerException: null at com.monitorjbl.xlsx.sst.FileBackedList.writeToFile(FileBackedList.java:74) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.sst.FileBackedList.add(FileBackedList.java:52) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.sst.BufferedStringsTable.readFrom(BufferedStringsTable.java:43) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.sst.BufferedStringsTable.<init>(BufferedStringsTable.java:31) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.sst.BufferedStringsTable.getSharedStringsTable(BufferedStringsTable.java:26) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.impl.StreamingWorkbookReader.init(StreamingWorkbookReader.java:120) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.impl.StreamingWorkbookReader.init(StreamingWorkbookReader.java:91) ~[xlsx-streamer-2.1.0.jar:na] at com.monitorjbl.xlsx.StreamingReader$Builder.open(StreamingReader.java:251) ~[xlsx-streamer-2.1.0.jar:na]
This happens because
BufferedStringsTable.parseCT_Rst
returns a NULL value which is then passed into theFileBackedList.add
method which causes an error.This could be fixed by performing a NULL check before adding it to the list. For example:
list.add(parseCT_Rst(xmlEventReader));
Becomes:String str = parseCT_Rst(xmlEventReader); if (str != null) list.add(str);