You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2019/08/22 21:57:51 UTC
svn commit: r1865720 - in /poi/trunk/src:
ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java
scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
Author: fanningpj
Date: Thu Aug 22 21:57:50 2019
New Revision: 1865720
URL: http://svn.apache.org/viewvc?rev=1865720&view=rev
Log:
[bug-63664] do not use DocumentBuilderFactory directly
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
Modified: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java?rev=1865720&r1=1865719&r2=1865720&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java Thu Aug 22 21:57:50 2019
@@ -27,7 +27,6 @@ import java.util.zip.ZipException;
import java.util.zip.ZipOutputStream;
import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
@@ -39,6 +38,7 @@ import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+import org.apache.poi.ooxml.util.DocumentHelper;
import org.apache.poi.openxml4j.opc.internal.ZipHelper;
import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.apache.poi.util.IOUtils;
@@ -53,14 +53,13 @@ import org.xml.sax.InputSource;
* use different formatting of the XML.
*/
public class OOXMLPrettyPrint {
- private final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
private final DocumentBuilder documentBuilder;
- public OOXMLPrettyPrint() throws ParserConfigurationException {
+ public OOXMLPrettyPrint() {
// allow files with much lower inflation rate here as there is no risk of Zip Bomb attacks in this developer tool
ZipSecureFile.setMinInflateRatio(0.00001);
- documentBuilder = documentBuilderFactory.newDocumentBuilder();
+ documentBuilder = DocumentHelper.newDocumentBuilder();
}
public static void main(String[] args) throws Exception {
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java?rev=1865720&r1=1865719&r2=1865720&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java Thu Aug 22 21:57:50 2019
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
@@ -142,7 +141,7 @@ public class WordToTextConverter extends
public WordToTextConverter() throws ParserConfigurationException
{
this.textDocumentFacade = new TextDocumentFacade(
- DocumentBuilderFactory.newInstance().newDocumentBuilder()
+ XMLHelper.getDocumentBuilderFactory().newDocumentBuilder()
.newDocument() );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org