Created attachment 31097 [details] File which causes a NPE when exporting xml data from I created a simple excel document with a mapped xml schema. I then tried to export the xml data from the excel sheet. This failed with a null pointer exception. Here is the stacktrace: java.lang.NullPointerException at org.apache.poi.xssf.extractor.XSSFExportToXml.indexOfElementInComplexType(XSSFExportToXml.java:430) at org.apache.poi.xssf.extractor.XSSFExportToXml.compare(XSSFExportToXml.java:411) at org.apache.poi.xssf.extractor.XSSFExportToXml.compare(XSSFExportToXml.java:77) at java.util.TimSort.countRunAndMakeAscending(TimSort.java:324) at java.util.TimSort.sort(TimSort.java:203) at java.util.TimSort.sort(TimSort.java:173) at java.util.Arrays.sort(Arrays.java:659) at java.util.Collections.sort(Collections.java:217) at org.apache.poi.xssf.extractor.XSSFExportToXml.exportToXML(XSSFExportToXml.java:157) This is the code which calls the poi api: XSSFMap map = mapInfo.getXSSFMapById(1); XSSFExportToXml exporter = new XSSFExportToXml(map); ByteArrayOutputStream os = new ByteArrayOutputStream(); exporter.exportToXML(os, true); // It fails here with a NPE String xmlData = os.toString("UTF-8"); And I also attached the excel file.
Created attachment 31099 [details] Patch for NPE including Unit Test
Committed as r1549007, good catch, thanks a lot for the Patch!