Unit test for non-reproducable #58747

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1720588 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2015-12-17 15:05:06 +00:00
parent ffe36ac2fe
commit 355810fb9f
2 changed files with 19 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.XSSFTestDataSamples; import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.model.CommentsTable; import org.apache.poi.xssf.model.CommentsTable;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.usermodel.XSSFRichTextString; import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.poi.xssf.usermodel.XSSFShape; import org.apache.poi.xssf.usermodel.XSSFShape;
import org.apache.poi.xssf.usermodel.XSSFSimpleShape; import org.apache.poi.xssf.usermodel.XSSFSimpleShape;
@ -196,4 +197,22 @@ public final class TestXSSFReader extends TestCase {
assertTrue(text.indexOf("Line 3") > -1); assertTrue(text.indexOf("Line 3") > -1);
} }
/**
* NPE from XSSFReader$SheetIterator.<init> on XLSX files generated by
* the openpyxl library
*/
public void test58747() throws Exception {
OPCPackage pkg = XSSFTestDataSamples.openSamplePackage("58747.xlsx");
ReadOnlySharedStringsTable strings = new ReadOnlySharedStringsTable(pkg);
XSSFReader reader = new XSSFReader(pkg);
StylesTable styles = reader.getStylesTable();
XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator) reader.getSheetsData();
assertEquals(true, iter.hasNext());
iter.next();
assertEquals(false, iter.hasNext());
assertEquals("Orders", iter.getSheetName());
}
} }

Binary file not shown.