aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2019-08-31 05:15:57 +0000
committerDominik Stadler <centic@apache.org>2019-08-31 05:15:57 +0000
commit2f1da7bc437a3825d1e4063abaedeff88c364341 (patch)
tree97f39a2c83ae136ed1f592ca07c845f96852ed6e
parent42005812c44a1eee2f0780b2c101c108a9c2fc6a (diff)
downloadpoi-2f1da7bc437a3825d1e4063abaedeff88c364341.tar.gz
poi-2f1da7bc437a3825d1e4063abaedeff88c364341.zip
Adjust reproducer test-case for bug 59322 to not print to stdout and close resources
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1866186 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java35
-rw-r--r--test-data/document/59322.docbin0 -> 39936 bytes
2 files changed, 8 insertions, 27 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
index 751813955e..e1388c4104 100644
--- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
+++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
@@ -24,19 +24,16 @@ import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.poi.POIDataSamples;
import org.apache.poi.hwpf.HWPFDocument;
-import org.apache.poi.hwpf.HWPFDocumentCore;
import org.apache.poi.hwpf.HWPFOldDocument;
import org.apache.poi.hwpf.HWPFTestDataSamples;
import org.apache.poi.hwpf.converter.AbstractWordUtils;
@@ -49,14 +46,13 @@ import org.apache.poi.hwpf.model.FileInformationBlock;
import org.apache.poi.hwpf.model.PicturesTable;
import org.apache.poi.hwpf.model.PlexOfField;
import org.apache.poi.hwpf.model.SubdocumentType;
+import org.apache.poi.ooxml.util.DocumentHelper;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.junit.Test;
import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* Test different problems reported in the Apache Bugzilla
@@ -901,27 +897,12 @@ public class TestBugs{
}
@Test
- public void test60217() throws Exception {
- File file = new File("/tmp/word-doc-with-revised-table.doc");
- FileInputStream fileInputStream = new FileInputStream(file);
- Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
- WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
- HWPFDocumentCore hwpfDocumentCore = new HWPFDocument(HWPFDocumentCore.verifyAndBuildPOIFS(fileInputStream));
- wordToHtmlConverter.processDocument(hwpfDocumentCore);
- System.out.println(document);
-
- System.out.println(document.getNodeName() + " -> " + document.getNodeValue());
-
- printNode(document, " ");
-
- System.out.println("Process Complete");
- }
-
- private void printNode(Node rootNode, String spacer) {
- System.out.println(spacer + rootNode.getNodeName() + " -> " + rootNode.getNodeValue());
- NodeList nl = rootNode.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++)
- printNode(nl.item(i), spacer + " ");
+ public void test59322() throws Exception {
+ try(HWPFDocument doc = HWPFTestDataSamples.openSampleFile("59322.doc")) {
+ Document document = DocumentHelper.createDocument();
+ WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
+ wordToHtmlConverter.processDocument(doc);
+ assertNotNull(document);
+ }
}
-
}
diff --git a/test-data/document/59322.doc b/test-data/document/59322.doc
new file mode 100644
index 0000000000..67e930936d
--- /dev/null
+++ b/test-data/document/59322.doc
Binary files differ