From bcafee36cc3f97b34c2384969bb132504ee6d46c Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sat, 16 Sep 2017 08:20:44 +0000 Subject: [PATCH] Adjust local test in integration-test file-handler git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808505 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/stress/XWPFFileHandler.java | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java b/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java index 142e816109..c3615713c2 100644 --- a/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/XWPFFileHandler.java @@ -16,38 +16,37 @@ ==================================================================== */ 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 -- 2.39.5