Author: nick
Date: Mon May 3 21:58:26 2010
New Revision: 940648
URL: http://svn.apache.org/viewvc?rev=940648&view=rev
Log:
Add DISABLED test which shows the latest problem relating to bug #49139
Modified:
poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java?rev=940648&r1=940647&r2=940648&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java
(original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java Mon
May 3 21:58:26 2010
@@ -33,7 +33,7 @@ import org.apache.poi.hpsf.ClassID;
*/
public interface DirectoryEntry
- extends Entry
+ extends Entry, Iterable<Entry>
{
/**
Modified:
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java?rev=940648&r1=940647&r2=940648&view=diff
==============================================================================
---
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
(original)
+++
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
Mon May 3 21:58:26 2010
@@ -177,9 +177,9 @@ public final class TestPOIFSFileSystem e
/**
* 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 e
);
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) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]