From c7f6c705beceb5475eb7d89d763b9b2573ad89e2 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sun, 1 Mar 2015 20:01:43 +0000 Subject: [PATCH] Bug 57165: also verify that createSheet() had the same problem and is also fixed now git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1663154 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/TestXSSFBugs.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index 1ebb56178a..6eaa3f14d1 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -2156,6 +2156,26 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { } } + @Test + public void test57165_create() throws IOException { + XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("57171_57163_57165.xlsx"); + try { + removeAllSheetsBut(3, wb); + wb.createSheet("newsheet"); // Throws exception here + wb.setSheetName(1, "New Sheet"); + //saveWorkbook(wb, fileName); + + XSSFWorkbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb); + try { + + } finally { + wbBack.close(); + } + } finally { + wb.close(); + } + } + private static void removeAllSheetsBut(int sheetIndex, Workbook wb) { int sheetNb = wb.getNumberOfSheets(); -- 2.39.5