]> source.dussan.org Git - poi.git/commitdiff
Patch from Trejkaz from bug #43116 - Fix for Escher handling of embeded OLE2 documents
authorNick Burch <nick@apache.org>
Wed, 15 Aug 2007 14:40:02 +0000 (14:40 +0000)
committerNick Burch <nick@apache.org>
Wed, 15 Aug 2007 14:40:02 +0000 (14:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@566196 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/ddf/EscherBlipRecord.java
src/testcases/org/apache/poi/hssf/data/ole2-embedding.xls [new file with mode: 0644]
src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java [new file with mode: 0644]

index 58af02a0c4f2666244571402c100167ceacbf895..e4f8c8ecda1520f2b5fa34901ea733c29e0de5fc 100644 (file)
@@ -36,6 +36,7 @@
     </devs>
 
         <release version="3.0.2-FINAL" date="2007-??-??">
+            <action dev="POI-DEVELOPERS" type="fix">43116 - [PATCH] - Fix for Escher layer handling of embeded OLE2 documents</action>
             <action dev="POI-DEVELOPERS" type="fix">43108 - [PATCH] - Where permissions deny fetching System Properties, use sensible defaults</action>
             <action dev="POI-DEVELOPERS" type="fix">43093 - [PATCH] - Fix formula evaluator support for Area3D references to other sheets</action>
             <action dev="POI-DEVELOPERS" type="fix">Improvements to HSSFDateUtils.isADateFormat, and have HSSFDateUtil.isCellDateFormatted use this</action>
index 04ee8163956b4544a8d93a396bc7b5448fd7230f..bceda3644fac01fc22a372186976ae9e2261ee31 100644 (file)
@@ -33,6 +33,7 @@
 
     <changes>
         <release version="3.0.2-FINAL" date="2007-??-??">
+            <action dev="POI-DEVELOPERS" type="fix">43116 - [PATCH] - Fix for Escher layer handling of embeded OLE2 documents</action>
             <action dev="POI-DEVELOPERS" type="fix">43108 - [PATCH] - Where permissions deny fetching System Properties, use sensible defaults</action>
             <action dev="POI-DEVELOPERS" type="fix">43093 - [PATCH] - Fix formula evaluator support for Area3D references to other sheets</action>
             <action dev="POI-DEVELOPERS" type="fix">Improvements to HSSFDateUtils.isADateFormat, and have HSSFDateUtil.isCellDateFormatted use this</action>
index 9ec3be30e6188e8d86f6d2bc4b6f163cb5ecf4d3..2c31f3f57d7cb47cb90e032f5157f6c82da236e6 100644 (file)
@@ -92,7 +92,7 @@ public class EscherBlipRecord
      */
     public int getRecordSize()
     {
-        return field_pictureData.length + 4;
+        return field_pictureData.length + HEADER_SIZE;
     }
 
     /**
diff --git a/src/testcases/org/apache/poi/hssf/data/ole2-embedding.xls b/src/testcases/org/apache/poi/hssf/data/ole2-embedding.xls
new file mode 100644 (file)
index 0000000..521082b
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/ole2-embedding.xls differ
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java b/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java
new file mode 100644 (file)
index 0000000..b0fd77b
--- /dev/null
@@ -0,0 +1,26 @@
+package org.apache.poi.hssf.usermodel;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import junit.framework.TestCase;
+
+public class TestOLE2Embeding extends TestCase {
+  public void testEmbeding() throws Exception {
+    String dirname = System.getProperty("HSSF.testdata.path");
+    String filename = dirname + "/ole2-embedding.xls";
+
+    File file = new File(filename);
+    FileInputStream in = new FileInputStream(file);
+    HSSFWorkbook workbook;
+
+       // This used to break, until bug #43116 was fixed
+    workbook = new HSSFWorkbook(in);
+
+    in.close();
+
+    // Check we can get at the Escher layer still
+    workbook.getAllPictures();
+  }
+}
+