You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ta...@apache.org on 2020/08/13 18:21:28 UTC

svn commit: r1880834 - in /poi/trunk: src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java test-data/spreadsheet/64667.xlsx

Author: tallison
Date: Thu Aug 13 18:21:28 2020
New Revision: 1880834

URL: http://svn.apache.org/viewvc?rev=1880834&view=rev
Log:
Bug 64667.xlsx prevent NPE loading styles table

Added:
    poi/trunk/test-data/spreadsheet/64667.xlsx   (with props)
Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java?rev=1880834&r1=1880833&r2=1880834&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java Thu Aug 13 18:21:28 2020
@@ -239,7 +239,7 @@ public class StylesTable extends POIXMLD
             if(styleDxfs != null) dxfs.addAll(Arrays.asList(styleDxfs.getDxfArray()));
 
             CTTableStyles ctTableStyles = styleSheet.getTableStyles();
-            if (ctTableStyles != null) {
+            if (ctTableStyles != null && styleDxfs != null) {
                 int idx = 0;
                 for (CTTableStyle style : ctTableStyles.getTableStyleArray()) {
                     tableStyles.put(style.getName(), new XSSFTableStyle(idx, styleDxfs, style, indexedColors));

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1880834&r1=1880833&r2=1880834&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Thu Aug 13 18:21:28 2020
@@ -3560,4 +3560,12 @@ public final class TestXSSFBugs extends
             Assert.assertEquals("", aCell.getStringCellValue());
         }
     }
+
+    @Test
+    public void testBug64667() throws IOException {
+        //test that an NPE isn't thrown on opening
+        try (Workbook wb = XSSFTestDataSamples.openSampleWorkbook("64667.xlsx")) {
+            int activeSheet = wb.getActiveSheetIndex();
+        }
+    }
 }

Added: poi/trunk/test-data/spreadsheet/64667.xlsx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/64667.xlsx?rev=1880834&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/64667.xlsx
------------------------------------------------------------------------------
--- svn:mime-type (added)
+++ svn:mime-type Thu Aug 13 18:21:28 2020
@@ -0,0 +1 @@
+application/vnd.openxmlformats-officedocument.spreadsheetml.sheet



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org