diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2020-04-21 22:13:59 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2020-04-21 22:13:59 +0000 |
commit | 778f4f5d7d847662d7788b43cdc0463c73aba76c (patch) | |
tree | 12508e4d23818739da01970cb26593be505729ad /src | |
parent | c8a5bdf22a0522b50d583c1033335cfc1dc19c43 (diff) | |
download | poi-778f4f5d7d847662d7788b43cdc0463c73aba76c.tar.gz poi-778f4f5d7d847662d7788b43cdc0463c73aba76c.zip |
#55505 - CountryRecord not found
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1876805 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/poi/hssf/model/LinkTable.java | 6 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/hssf/model/LinkTable.java b/src/java/org/apache/poi/hssf/model/LinkTable.java index 7184ccc98d..cb64d6dca9 100644 --- a/src/java/org/apache/poi/hssf/model/LinkTable.java +++ b/src/java/org/apache/poi/hssf/model/LinkTable.java @@ -30,6 +30,7 @@ import org.apache.poi.hssf.record.ExternalNameRecord; import org.apache.poi.hssf.record.NameCommentRecord; import org.apache.poi.hssf.record.NameRecord; import org.apache.poi.hssf.record.Record; +import org.apache.poi.hssf.record.SSTRecord; import org.apache.poi.hssf.record.SupBookRecord; import org.apache.poi.ss.formula.SheetNameFormatter; import org.apache.poi.ss.formula.ptg.Area3DPtg; @@ -271,7 +272,10 @@ final class LinkTable { int idx = findFirstRecordLocBySid(CountryRecord.sid); if (idx < 0) { - throw new RuntimeException("CountryRecord not found"); + idx = findFirstRecordLocBySid(SSTRecord.sid) - 1; + if (idx < 0) { + throw new RuntimeException("CountryRecord or SSTRecord not found"); + } } _workbookRecordList.add(idx + 1, _externSheetRecord); _workbookRecordList.add(idx + 1, supbook); diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index cd2bfe32bc..1a09c5596b 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -59,7 +59,6 @@ import org.apache.poi.hssf.record.CellValueRecordInterface; import org.apache.poi.hssf.record.CommonObjectDataSubRecord; import org.apache.poi.hssf.record.EmbeddedObjectRefSubRecord; import org.apache.poi.hssf.record.NameRecord; -import org.apache.poi.hssf.record.Record; import org.apache.poi.hssf.record.TabIdRecord; import org.apache.poi.hssf.record.UnknownRecord; import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate; @@ -2888,6 +2887,11 @@ public final class TestBugs extends BaseTestBugzillaIssues { } @Test + public void test55505() throws IOException { + simpleTest("bug55505.xls"); + } + + @Test public void test63940() throws IOException { simpleTest("SUBSTITUTE.xls"); } @@ -2910,6 +2914,11 @@ public final class TestBugs extends BaseTestBugzillaIssues { HSSFRow r = s.createRow(10_000); HSSFCell c = r.createCell(0); c.setCellValue(10); + + HSSFSheet tmpSheet = wb1.createSheet("POITESTSHEET"); + tmpSheet.createRow(10).createCell(10).setCellValue("Test"); + wb1.removeSheetAt(wb1.getSheetIndex(tmpSheet)); + simpleTestHelper(wb1, fileName); try (HSSFWorkbook wb2 = writeOutAndReadBack(wb1)) { |