You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2015/03/22 22:47:20 UTC

svn commit: r1668482 - in /poi/trunk: src/integrationtest/org/apache/poi/stress/ test-data/document/

Author: centic
Date: Sun Mar 22 21:47:19 2015
New Revision: 1668482

URL: http://svn.apache.org/r1668482
Log:
Add test-document to verify that bug 51921 is fixed already

Added:
    poi/trunk/test-data/document/51921-Word-Crash067.doc
    poi/trunk/test-data/document/51921-Word-Crash067.docx
Modified:
    poi/trunk/src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java
    poi/trunk/src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java
    poi/trunk/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java

Modified: poi/trunk/src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java?rev=1668482&r1=1668481&r2=1668482&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/stress/HPBFFileHandler.java Sun Mar 22 21:47:19 2015
@@ -18,10 +18,12 @@ package org.apache.poi.stress;
 
 import static org.junit.Assert.assertNotNull;
 
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 
 import org.apache.poi.hpbf.HPBFDocument;
+import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.junit.Test;
 
@@ -39,11 +41,28 @@ public class HPBFFileHandler extends POI
 	// a test-case to test this locally without executing the full TestAllFiles
 	@Test
 	public void test() throws Exception {
-		InputStream stream = new FileInputStream("test-data/publisher/SampleBrochure.pub");
+		File file = new File("test-data/publisher/SampleBrochure.pub");
+
+		InputStream stream = new FileInputStream(file);
 		try {
 			handleFile(stream);
 		} finally {
 			stream.close();
 		}
+		
+		handleExtracting(file);
+		
+		stream = new FileInputStream(file);
+		try {
+			PublisherTextExtractor extractor = new PublisherTextExtractor(stream);
+			try {
+				assertNotNull(extractor.getText());
+			} finally {
+				extractor.close();
+			}
+		} finally {
+			stream.close();
+		}
 	}
+	
 }

Modified: poi/trunk/src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java?rev=1668482&r1=1668481&r2=1668482&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/stress/HWPFFileHandler.java Sun Mar 22 21:47:19 2015
@@ -68,7 +68,7 @@ public class HWPFFileHandler extends POI
 	// a test-case to test this locally without executing the full TestAllFiles
 	@Test
 	public void test() throws Exception {
-		File file = new File("test-data/document/47304.doc");
+		File file = new File("test-data/document/51921-Word-Crash067.doc");
 
 		InputStream stream = new FileInputStream(file);
 		try {
@@ -91,4 +91,4 @@ public class HWPFFileHandler extends POI
 			stream.close();
 		}
 	}
-}
\ No newline at end of file
+}

Modified: poi/trunk/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java?rev=1668482&r1=1668481&r2=1668482&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java Sun Mar 22 21:47:19 2015
@@ -16,8 +16,10 @@
 ==================================================================== */
 package org.apache.poi.stress;
 
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
+import java.io.PushbackInputStream;
 
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
 import org.junit.Test;
@@ -36,12 +38,16 @@ public class XWPFFileHandler extends Abs
 	// a test-case to test this locally without executing the full TestAllFiles
 	@Test
 	public void test() throws Exception {
-		InputStream stream = new FileInputStream("test-data/document/footnotes.docx");
+		File file = new File("test-data/document/51921-Word-Crash067.docx");
+
+		InputStream stream = new PushbackInputStream(new FileInputStream(file), 100000);
 		try {
 			handleFile(stream);
 		} finally {
 			stream.close();
 		}
+		
+		handleExtracting(file);
 	}
 	
 }
\ No newline at end of file

Added: poi/trunk/test-data/document/51921-Word-Crash067.doc
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/document/51921-Word-Crash067.doc?rev=1668482&view=auto
==============================================================================
Binary files poi/trunk/test-data/document/51921-Word-Crash067.doc (added) and poi/trunk/test-data/document/51921-Word-Crash067.doc Sun Mar 22 21:47:19 2015 differ

Added: poi/trunk/test-data/document/51921-Word-Crash067.docx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/document/51921-Word-Crash067.docx?rev=1668482&view=auto
==============================================================================
Binary files poi/trunk/test-data/document/51921-Word-Crash067.docx (added) and poi/trunk/test-data/document/51921-Word-Crash067.docx Sun Mar 22 21:47:19 2015 differ



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