diff options
author | Tim Allison <tallison@apache.org> | 2020-02-10 17:38:29 +0000 |
---|---|---|
committer | Tim Allison <tallison@apache.org> | 2020-02-10 17:38:29 +0000 |
commit | 636cc8366581619065229fe45dccb70ff7fd1a42 (patch) | |
tree | 88e478b2c5b2168598cc9dc3c938bfe0ac8fbe29 /src/testcases/org/apache/poi/hssf | |
parent | d5ba6195a5e526f32ea2865a17b4deb7d698b9fb (diff) | |
download | poi-636cc8366581619065229fe45dccb70ff7fd1a42.tar.gz poi-636cc8366581619065229fe45dccb70ff7fd1a42.zip |
Bug 64130 -- handle empty worksheet names in OldSheetRecord more robustly.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1873863 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf')
7 files changed, 21 insertions, 1 deletions
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java index f493036cf3..17b43f0da1 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java @@ -45,6 +45,7 @@ public class TestBiffDrawingToXml extends BaseXLSIteratingTest { EXCLUDED.put("43493.xls", RecordInputStream.LeftoverDataException.class); // HSSFWorkbook cannot open it as well EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class); EXCLUDED.put("61300.xls", RecordFormatException.class); + EXCLUDED.put("64130.xls", OldExcelFormatException.class); // BIFF 5 } @Override diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java index a62431bc55..82a46327b9 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java @@ -54,6 +54,7 @@ public class TestBiffViewer extends BaseXLSIteratingTest { EXCLUDED.put("50833.xls", IllegalArgumentException.class); // "Name is too long" when setting username EXCLUDED.put("XRefCalc.xls", RuntimeException.class); // "Buffer overrun" EXCLUDED.put("61300.xls", RecordFormatException.class); + EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5 } @Override diff --git a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java index 3daf938d5c..a24b4967f7 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java @@ -47,6 +47,7 @@ public class TestEFBiffViewer extends BaseXLSIteratingTest { EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class); EXCLUDED.put("XRefCalc.xls", RuntimeException.class); // "Buffer overrun" EXCLUDED.put("61300.xls", RecordFormatException.class); + EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5 } @Override diff --git a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java index e94d55ddfb..ec69abb4cb 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java @@ -47,6 +47,7 @@ public class TestFormulaViewer extends BaseXLSIteratingTest { EXCLUDED.put("43493.xls", RecordInputStream.LeftoverDataException.class); // HSSFWorkbook cannot open it as well EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class); EXCLUDED.put("61300.xls", RecordFormatException.class); + EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5 } @Override diff --git a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java index a8d59873e1..97b84e21ac 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java @@ -51,6 +51,7 @@ public class TestReSave extends BaseXLSIteratingTest { EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class); EXCLUDED.put("XRefCalc.xls", RuntimeException.class); // "Buffer overrun" EXCLUDED.put("61300.xls", RecordFormatException.class); + EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5 } @Override diff --git a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java index ec7cd8c087..f15801390b 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java @@ -38,7 +38,7 @@ public class TestRecordLister extends BaseXLSIteratingTest { EXCLUDED.put("60284.xls", OldExcelFormatException.class); // Biff 5 / Excel 5 EXCLUDED.put("testEXCEL_95.xls", OldExcelFormatException.class); // Biff 5 / Excel 95 EXCLUDED.put("61300.xls", RecordFormatException.class); - + EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5 } @Override diff --git a/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java b/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java index 1ce8a92c22..6403fe4e74 100644 --- a/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java +++ b/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java @@ -267,6 +267,10 @@ public final class TestOldExcelExtractor { @Test public void testInputStreamNPOIHeader() throws IOException { + //TODO: the worksheet names are currently mangled. They're treated + //as if UTF-16, but they're just ascii. Need to fix this. + //Is it possible that the leading 0 byte in the worksheet name is a signal + //that these worksheet names should be interpreted as ascii/1252? File file = HSSFTestDataSamples.getSampleFile("FormulaRefs.xls"); try (InputStream stream = new FileInputStream(file); OldExcelExtractor extractor = new OldExcelExtractor(stream)) { @@ -350,6 +354,17 @@ public final class TestOldExcelExtractor { } } + @Test + public void testSheetWithNoName() throws IOException { + File file = HSSFTestDataSamples.getSampleFile("64130.xls"); + + try (OldExcelExtractor ex = new OldExcelExtractor(file)) { + assertEquals(5, ex.getBiffVersion()); + assertEquals(5, ex.getFileType()); + assertContains(ex.getText(), "Dawn"); + } + } + private static class NoExitSecurityManager extends SecurityManager { @Override public void checkPermission(Permission perm) { |