diff options
author | Nick Burch <nick@apache.org> | 2010-05-03 21:58:26 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2010-05-03 21:58:26 +0000 |
commit | e0ae7b1177f144db1de04bc5d17eec42fd4ac458 (patch) | |
tree | 1b2dd6896c8657d2ffc6026346b23c671c02b49f /src | |
parent | 311e03f1e7a5532c10dbc7f7cfe998203c70c12b (diff) | |
download | poi-e0ae7b1177f144db1de04bc5d17eec42fd4ac458.tar.gz poi-e0ae7b1177f144db1de04bc5d17eec42fd4ac458.zip |
Add DISABLED test which shows the latest problem relating to bug #49139
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@940648 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java | 2 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java | 21 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java b/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java index 8b7119b571..844070fb50 100644 --- a/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java +++ b/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java @@ -33,7 +33,7 @@ import org.apache.poi.hpsf.ClassID; */ public interface DirectoryEntry - extends Entry + extends Entry, Iterable<Entry> { /** diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java b/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java index 5bb740881a..1b370124f6 100644 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java @@ -177,9 +177,9 @@ public final class TestPOIFSFileSystem extends TestCase { /** * Most OLE2 files use 512byte blocks. However, a small number * use 4k blocks. Check that we can open these. - * DISABLED until we get a sample 4k block file that's under 22mb... + * DISABLED until we fix the bug with DocumentBlocks on 4k sizes */ - public void test4KBlocks() throws Exception { + public void DISABLEDtest4KBlocks() throws Exception { POIDataSamples _samples = POIDataSamples.getPOIFSInstance(); InputStream inp = _samples.openResourceAsStream("BlockSize4096.zvi"); @@ -203,11 +203,28 @@ public final class TestPOIFSFileSystem extends TestCase { ); assertTrue(fs.getRoot().getEntryCount() > 3); + // Check we can get at all the contents + checkAllDirectoryContents(fs.getRoot()); + + // Finally, check we can do a similar 512byte one too fs = new POIFSFileSystem( _samples.openResourceAsStream("BlockSize512.zvi") ); assertTrue(fs.getRoot().getEntryCount() > 3); + checkAllDirectoryContents(fs.getRoot()); + } + private void checkAllDirectoryContents(DirectoryEntry dir) throws IOException { + for(Entry entry : dir) { + if(entry instanceof DirectoryEntry) { + checkAllDirectoryContents((DirectoryEntry)entry); + } else { + DocumentInputStream dis = new DocumentInputStream((DocumentNode) entry); + int numBytes = dis.available(); + byte[] data = new byte [numBytes]; + dis.read(data); + } + } } private static InputStream openSampleStream(String sampleFileName) { |