]> source.dussan.org Git - poi.git/commitdiff
Adjust local test in integration-test file-handler
authorDominik Stadler <centic@apache.org>
Sat, 16 Sep 2017 08:20:44 +0000 (08:20 +0000)
committerDominik Stadler <centic@apache.org>
Sat, 16 Sep 2017 08:20:44 +0000 (08:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808505 13f79535-47bb-0310-9956-ffa450edef68

src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java

index 142e8161091ad4a9a1b70aa14d1d7ae3edf92c23..c3615713c2632d3e048368166055d7d654b4ffda 100644 (file)
 ==================================================================== */
 package org.apache.poi.stress;
 
+import java.io.BufferedInputStream;
 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;
 
 public class XWPFFileHandler extends AbstractFileHandler {
-       @Override
+    @Override
     public void handleFile(InputStream stream, String path) throws Exception {
         // ignore password protected files
         if (POIXMLDocumentHandler.isEncrypted(stream)) return;
 
         XWPFDocument doc = new XWPFDocument(stream);
-               
-               new POIXMLDocumentHandler().handlePOIXMLDocument(doc);
-       }
+        
+        new POIXMLDocumentHandler().handlePOIXMLDocument(doc);
+    }
 
-       // a test-case to test this locally without executing the full TestAllFiles
-       @Test
-       public void test() throws Exception {
+    // 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/51921-Word-Crash067.docx");
 
-        InputStream stream = new PushbackInputStream(new FileInputStream(file), 100000);
-               try {
-                       handleFile(stream, file.getPath());
-               } finally {
-                       stream.close();
-               }
-               
-               handleExtracting(file);
-       }
-       
+        InputStream stream = new BufferedInputStream(new FileInputStream(file));
+        try {
+            handleFile(stream, file.getPath());
+        } finally {
+            stream.close();
+        }
+
+        handleExtracting(file);
+    }
 }
\ No newline at end of file