poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gwool...@apache.org
Subject svn commit: r1786953 - in /poi/trunk/src: java/org/apache/poi/ss/formula/functions/Baseifs.java ooxml/testcases/org/apache/poi/ss/formula/functions/TestSumifsXSSF.java
Date Tue, 14 Mar 2017 21:39:33 GMT
Author: gwoolsey
Date: Tue Mar 14 21:39:33 2017
New Revision: 1786953

URL: http://svn.apache.org/viewvc?rev=1786953&view=rev
Log:
Fixed #60858, which showed a regression of the fix for #56420 introduced by my refactoring
to fix #56822.

Includes new unit test based on the bug sample file.

Added:
    poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestSumifsXSSF.java
  (with props)
Modified:
    poi/trunk/src/java/org/apache/poi/ss/formula/functions/Baseifs.java

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/functions/Baseifs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/functions/Baseifs.java?rev=1786953&r1=1786952&r2=1786953&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/functions/Baseifs.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/functions/Baseifs.java Tue Mar 14 21:39:33
2017
@@ -135,7 +135,8 @@ import org.apache.poi.ss.formula.functio
                     AreaEval aeRange = ranges[i];
                     I_MatchPredicate mp = predicates[i];
 
-                    if (!mp.matches(aeRange.getRelativeValue(r, c))) {
+                    // Bugs 60858 and 56420 show predicate can be null
+                    if (mp == null || !mp.matches(aeRange.getRelativeValue(r, c))) {
                         matches = false;
                         break;
                     }

Added: poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestSumifsXSSF.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestSumifsXSSF.java?rev=1786953&view=auto
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestSumifsXSSF.java
(added)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestSumifsXSSF.java
Tue Mar 14 21:39:33 2017
@@ -0,0 +1,31 @@
+package org.apache.poi.ss.formula.functions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.FormulaEvaluator;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.XSSFTestDataSamples;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class TestSumifsXSSF {
+
+    /**
+     * handle null cell predicate
+     */
+    @Test
+    public void testBug60858() {
+        Workbook wb = XSSFTestDataSamples.openSampleWorkbook("bug60858.xlsx");
+        FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
+
+        Sheet sheet = wb.getSheetAt(0);
+        Cell cell = sheet.getRow(1).getCell(5);
+        fe.evaluate(cell);
+        assertEquals(0.0, cell.getNumericCellValue(), 0.0000000000000001);
+    }
+
+}

Propchange: poi/trunk/src/ooxml/testcases/org/apache/poi/ss/formula/functions/TestSumifsXSSF.java
------------------------------------------------------------------------------
    svn:eol-style = native



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


Mime
View raw message