diff --git a/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java b/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java index 3a507f57c1..8c390a0d33 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java @@ -25,6 +25,7 @@ import org.apache.poi.hssf.usermodel.HSSFRow; 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)); + } + } }