You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jz...@apache.org on 2020/06/02 11:42:36 UTC

[opennlp] branch master updated: OPENNLP-1305: Disable DTD loading. (#376)

This is an automated email from the ASF dual-hosted git repository.

jzemerick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/opennlp.git


The following commit(s) were added to refs/heads/master by this push:
     new e4b331d  OPENNLP-1305: Disable DTD loading. (#376)
e4b331d is described below

commit e4b331d04dcbddea30a76ddcf38f1079f9903861
Author: Jeff Zemerick <jz...@apache.org>
AuthorDate: Tue Jun 2 07:42:25 2020 -0400

    OPENNLP-1305: Disable DTD loading. (#376)
---
 .../src/main/java/opennlp/tools/formats/letsmt/LetsmtDocument.java       | 1 +
 1 file changed, 1 insertion(+)

diff --git a/opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtDocument.java b/opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtDocument.java
index 3aa880f..eb10b7c 100644
--- a/opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtDocument.java
+++ b/opennlp-tools/src/main/java/opennlp/tools/formats/letsmt/LetsmtDocument.java
@@ -124,6 +124,7 @@ public class LetsmtDocument {
       XMLReader xmlReader = saxParser.getXMLReader();
       LetsmtDocumentHandler docHandler = new LetsmtDocumentHandler();
       xmlReader.setContentHandler(docHandler);
+      xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
       xmlReader.parse(new InputSource(letsmtXmlIn));
       return new LetsmtDocument(docHandler.sentences);
     } catch (SAXException e) {