From 35470f6386606dae8b8e194f0199660a95d8de8d Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Thu, 17 Dec 2015 15:05:06 +0000 Subject: [PATCH] Unit test for non-reproducable #58747 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1720588 13f79535-47bb-0310-9956-ffa450edef68 --- .../xssf/eventusermodel/TestXSSFReader.java | 19 ++++++++++++++++++ test-data/spreadsheet/58747.xlsx | Bin 0 -> 8552 bytes 2 files changed, 19 insertions(+) create mode 100644 test-data/spreadsheet/58747.xlsx diff --git a/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestXSSFReader.java b/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestXSSFReader.java index 85613d3e47..b964ced1d6 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestXSSFReader.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestXSSFReader.java @@ -27,6 +27,7 @@ import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.XSSFTestDataSamples; 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.XSSFShape; import org.apache.poi.xssf.usermodel.XSSFSimpleShape; @@ -196,4 +197,22 @@ public final class TestXSSFReader extends TestCase { assertTrue(text.indexOf("Line 3") > -1); } + + /** + * NPE from XSSFReader$SheetIterator. 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()); + } } diff --git a/test-data/spreadsheet/58747.xlsx b/test-data/spreadsheet/58747.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..2bfec8a5547d496686ce990671c7a0041f66e970 GIT binary patch literal 8552 zcmeHM1y@|z(rq9(1P=}g9^3;2mjt)QHAo}D8h0nSyEG6Sf;+(>Sb}R3I=H(Am#;JP z-kTX_zF+X(>DBkFUiVh5zUS0FwQHBM9Ks`f01^NN002A#81H9V7{LJmv5x=%JOB#3 zu7sVf6Uf%dP|Y0-a@1#av$1}f`v{)lJpdl|{Qt&(@d}hBDkyzo#|S=v!E}9VfrNX)eGlgR_5H=jl8;Ik}LYpgL_3y z7a1#~GE$aJ&f*s$Fl6}4%UqSiG2f>~R#v{MRR9d}L5-f1i1Eyy>Kp|V3vJ5@iM15Odmnc+ud6G;MAQdNMi}12iwHUjs1fQcs zkNt}>ZL^L;0_n58wKxL!&pLW8(*LwGqmK&24mW)!>cC3Eoz`RE=gE$jZZG$%bq z9Pg9E?xMNyEC*Y)N4JV`^ef8%k@^^W@Pd3E)&L&<(hcM8>-@nH1avVPgpg-jRt!l+(DttA~@ak76sW8`GfG4 z;AKrCw}PD;+q$=LiejW_7T(K2mo*79^pa6%ak}`ROd!DtWD@7|HI)fM7Tv6#(&>Ez zpFNda*qHRGPbj``jx@{4H`ID8iVD!|L##1KPub9j@@?= zeIo-IyJuEc=ur$B9nH7tubNOoGVTqz)hlVL7B|(!)RnwMQ?lsvaP097Mbe34{=uow z#lvE*3@XJ2&^zy9*P5_+tg zyteRpAR(%>1Gd|LKUt?bc0s(bJEyQO7AzQGG4tnWiBu7Tp$fZ|`Uu(TUmkbEO4GyxN?A^Jot*Nf8yTTAC2X2*$XhM9pJw+*!F7fM;JlaB+oTRWf-;OsC zWC=)nrbv7;L3s1BHcQ3q==bAb=W-@5@N~OWMl=;%lzg3!bzO||h?Nc4+o>o2oUNvy z4GSqXjzfqsQyG;A&x!obGN`R%!AfFRKaQYtu=cb1)3FwPtKDU#j*#7|agC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