From dd4f3c2fc7893edd914954c73eb577f925a7d361 Mon Sep 17 00:00:00 2001
From: Rolf Lear <rolf@tuis.net>
Date: Thu, 1 Jul 2021 23:42:05 -0400
Subject: [PATCH] Addresses #189 - synchronizes external entity expansion
 setting

---
 core/src/java/org/jdom2/input/SAXBuilder.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/core/src/java/org/jdom2/input/SAXBuilder.java b/core/src/java/org/jdom2/input/SAXBuilder.java
index a1462334..514b026d 100644
--- a/core/src/java/org/jdom2/input/SAXBuilder.java
+++ b/core/src/java/org/jdom2/input/SAXBuilder.java
@@ -82,6 +82,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 import org.jdom2.DocType;
 import org.jdom2.Document;
 import org.jdom2.EntityRef;
+import org.jdom2.JDOMConstants;
 import org.jdom2.JDOMException;
 import org.jdom2.JDOMFactory;
 import org.jdom2.Verifier;
@@ -797,6 +798,11 @@ public void setFastReconfigure(final boolean fastReconfigure) {
 	public void setFeature(final String name, final boolean value) {
 		// Save the specified feature for later.
 		features.put(name, value ? Boolean.TRUE : Boolean.FALSE);
+		if (JDOMConstants.SAX_FEATURE_EXTERNAL_ENT.equals(name)) {
+			// See issue https://github.com/hunterhacker/jdom/issues/189
+			// And PR https://github.com/hunterhacker/jdom/pull/188
+			setExpandEntities(value);
+		}
 		engine = null;
 	}
 
