You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2022/07/01 12:55:33 UTC

svn commit: r1902390 - /poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java

Author: fanningpj
Date: Fri Jul  1 12:55:33 2022
New Revision: 1902390

URL: http://svn.apache.org/viewvc?rev=1902390&view=rev
Log:
[bug-66152] add broken test

Modified:
    poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java

Modified: poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java?rev=1902390&r1=1902389&r2=1902390&view=diff
==============================================================================
--- poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java (original)
+++ poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java Fri Jul  1 12:55:33 2022
@@ -25,6 +25,7 @@ import org.apache.poi.hssf.usermodel.HSS
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.CellType;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
@@ -72,4 +73,24 @@ class TestFormulaEval {
             assertEquals(CellType.ERROR, cell1.getCellType());
         }
     }
+
+    @Disabled("currently causes a StackOverflowError")
+    @Test
+    void testBug66152() throws IOException {
+        try (HSSFWorkbook wb = new HSSFWorkbook()) {
+            HSSFSheet sheet = wb.createSheet();
+            HSSFRow r0 = sheet.createRow(0);
+            HSSFCell c0 = r0.createCell(0);
+            c0.setCellValue(1);
+            HSSFCell cell = null;
+            for (int i = 1; i < 1200; i++) {
+                HSSFRow row = sheet.createRow(i);
+                cell = row.createCell(0);
+                cell.setCellFormula("SUM(A" + i + " + 1)");
+            }
+            HSSFFormulaEvaluator formulaEvaluator = wb.getCreationHelper().createFormulaEvaluator();
+            //formulaEvaluator.evaluateAll(); //this workaround avoids the stackoverflow issue
+            assertEquals(CellType.NUMERIC, formulaEvaluator.evaluateFormulaCell(cell));
+        }
+    }
 }



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