You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2008/05/07 00:51:29 UTC
svn commit: r653945 - in /poi/trunk/src: java/org/apache/poi/poifs/storage/
testcases/org/apache/poi/poifs/data/
testcases/org/apache/poi/poifs/filesystem/
Author: nick
Date: Tue May 6 15:51:28 2008
New Revision: 653945
URL: http://svn.apache.org/viewvc?rev=653945&view=rev
Log:
Add disabled test for bug #44898, and slightly improve a few poifs related error messages
Added:
poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp (with props)
poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps (with props)
Modified:
poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java
poi/trunk/src/java/org/apache/poi/poifs/storage/RawDataBlock.java
poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
Modified: poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java?rev=653945&r1=653944&r2=653945&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/storage/BlockListImpl.java Tue May 6 15:51:28 2008
@@ -102,7 +102,8 @@
catch (ArrayIndexOutOfBoundsException ignored)
{
throw new IOException("Cannot remove block[ " + index
- + " ]; out of range");
+ + " ]; out of range[ 0 - " +
+ (_blocks.length-1) + " ]");
}
return result;
}
Modified: poi/trunk/src/java/org/apache/poi/poifs/storage/RawDataBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/storage/RawDataBlock.java?rev=653945&r1=653944&r2=653945&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/storage/RawDataBlock.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/storage/RawDataBlock.java Tue May 6 15:51:28 2008
@@ -81,8 +81,9 @@
log.log(POILogger.ERROR,
"Unable to read entire block; " + count
+ type + " read before EOF; expected "
- + blockSize + " bytes. Your document"
- + " has probably been truncated!"
+ + blockSize + " bytes. Your document "
+ + "was either written by software that "
+ + "ignores the spec, or has been truncated!"
);
}
else {
Added: poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp?rev=653945&view=auto
==============================================================================
Binary file - no diff available.
Propchange: poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.qwp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps?rev=653945&view=auto
==============================================================================
Binary file - no diff available.
Propchange: poi/trunk/src/testcases/org/apache/poi/poifs/data/ShortLastBlock.wps
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
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=653945&r1=653944&r2=653945&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 Tue May 6 15:51:28 2008
@@ -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 @@
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);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org