poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1661908 - in /poi/trunk: src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java test-data/document/zero-length.docx
Date Tue, 24 Feb 2015 12:09:30 GMT
Author: nick
Date: Tue Feb 24 12:09:30 2015
New Revision: 1661908

URL: http://svn.apache.org/r1661908
Log:
Patch from rojotek from github-18 - Handle documents with a picture-only header

Added:
    poi/trunk/test-data/document/zero-length.docx   (with props)
Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java?rev=1661908&r1=1661907&r2=1661908&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java Tue Feb 24 12:09:30
2015
@@ -92,7 +92,7 @@ public class XWPFDocument extends POIXML
     /**
      * Keeps track on all id-values used in this document and included parts, like headers,
footers, etc.
      */
-    private IdentifierManager drawingIdManager = new IdentifierManager(1L,4294967295L);
+    private IdentifierManager drawingIdManager = new IdentifierManager(0L,4294967295L);
     protected List<XWPFFooter> footers = new ArrayList<XWPFFooter>();
     protected List<XWPFHeader> headers = new ArrayList<XWPFHeader>();
     protected List<XWPFComment> comments = new ArrayList<XWPFComment>();

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java?rev=1661908&r1=1661907&r2=1661908&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java Tue
Feb 24 12:09:30 2015
@@ -337,6 +337,21 @@ public final class TestXWPFDocument exte
 	    
 	    doc.getPackage().revert();
 	}
+    public void testZeroLengthLibreOfficeDocumentWithWaterMarkHeader() throws IOException
{
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("zero-length.docx");
+        POIXMLProperties properties = doc.getProperties();
+
+        assertNotNull(properties.getCoreProperties());
+
+        XWPFHeader headerArray = doc.getHeaderArray(0);
+        assertEquals(1, headerArray.getAllPictures().size());
+        assertEquals("image1.png", headerArray.pictures.get(0).getFileName());
+        assertEquals("", headerArray.getText());
+
+        POIXMLProperties.ExtendedProperties extendedProperties = properties.getExtendedProperties();
+        assertNotNull(extendedProperties);
+        assertEquals(0, extendedProperties.getUnderlyingProperties().getCharacters());
+    }
 
     public void testSettings(){
         XWPFSettings settings = new XWPFSettings();

Added: poi/trunk/test-data/document/zero-length.docx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/document/zero-length.docx?rev=1661908&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/document/zero-length.docx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message