diff options
author | Nick Burch <nick@apache.org> | 2008-05-06 22:51:28 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2008-05-06 22:51:28 +0000 |
commit | bc00daac893269cafccdfa461b66e6560f1ba3d4 (patch) | |
tree | 65a724f25b964c6f82d7221f6953f146d5f72be2 /src/testcases/org/apache/poi/poifs | |
parent | 9d0ca2d5734d9a3d87e7766409ff35988b996329 (diff) | |
download | poi-bc00daac893269cafccdfa461b66e6560f1ba3d4.tar.gz poi-bc00daac893269cafccdfa461b66e6560f1ba3d4.zip |
Add disabled test for bug #44898, and slightly improve a few poifs related error messages
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@653945 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/poifs')
-rw-r--r-- | src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp | bin | 0 -> 1303681 bytes | |||
-rw-r--r-- | src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps | bin | 0 -> 140787 bytes | |||
-rwxr-xr-x | src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java | 37 |
3 files changed, 37 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp b/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp Binary files differnew file mode 100644 index 0000000000..b278d06c20 --- /dev/null +++ b/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp diff --git a/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps b/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps Binary files differnew file mode 100644 index 0000000000..1b1a627a99 --- /dev/null +++ b/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java b/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java index d792dcf227..1cde86918b 100755 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java @@ -17,6 +17,9 @@ package org.apache.poi.poifs.filesystem; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -115,6 +118,40 @@ public final class TestPOIFSFileSystem extends TestCase { assertTrue("input stream was not closed", testIS.isClosed()); // but still should close } + + /** + * Test for bug # 48898 - problem opening an OLE2 + * file where the last block is short (i.e. not a full + * multiple of 512 bytes) + * + * As yet, this problem remains. One school of thought is + * not not issue an EOF when we discover the last block + * is short, but this seems a bit wrong. + * The other is to fix the handling of the last block in + * POIFS, since it seems to be slight wrong + */ + public void DISABLEDtestShortLastBlock() throws Exception { + String[] files = new String[] { + "ShortLastBlock.qwp", "ShortLastBlock.wps" + }; + String pdirname = System.getProperty("POIFS.testdata.path"); + + for(int i=0; i<files.length; i++) { + File f = new File(pdirname, files[i]); + assertTrue(f.exists()); + + // Open the file up + POIFSFileSystem fs = new POIFSFileSystem( + new FileInputStream(f) + ); + + // Write it into a temp output array + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + fs.writeFilesystem(baos); + + // Check sizes + } + } private static InputStream openSampleStream(String sampleFileName) { return HSSFTestDataSamples.openSampleFileStream(sampleFileName); |