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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new ed3df4b2 Internal clean up
ed3df4b2 is described below

commit ed3df4b25cd5301921a6523ae7db2411f4a84d98
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Dec 3 17:23:54 2025 -0500

    Internal clean up
---
 .../org/apache/commons/text/lookup/XmlStringLookup.java  | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java 
b/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java
index 26739c02..85747eeb 100644
--- a/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/XmlStringLookup.java
@@ -130,7 +130,7 @@ final class XmlStringLookup extends 
AbstractPathFencedLookup {
         if (keyLen != KEY_PARTS_LEN) {
             throw IllegalArgumentExceptions.format("Bad XML key format '%s'; 
the expected format is 'DocumentPath:XPath'.", key);
         }
-        final Boolean secure = isSecure();
+        final boolean secure = isSecure();
         final String documentPath = keys[0];
         final String xpath = StringUtils.substringAfterLast(key, SPLIT_CH);
         final DocumentBuilderFactory dbFactory = 
DocumentBuilderFactory.newInstance();
@@ -138,19 +138,15 @@ final class XmlStringLookup extends 
AbstractPathFencedLookup {
             for (final Entry<String, Boolean> p : 
xmlFactoryFeatures.entrySet()) {
                 dbFactory.setFeature(p.getKey(), p.getValue());
             }
-            if (secure != null) {
-                dbFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, 
secure.booleanValue());
-            }
+            dbFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, 
secure);
             try (InputStream inputStream = 
Files.newInputStream(getPath(documentPath))) {
                 final Document doc = 
dbFactory.newDocumentBuilder().parse(inputStream);
-                final XPathFactory factory = XPathFactory.newInstance();
+                final XPathFactory xpFactory = XPathFactory.newInstance();
                 for (final Entry<String, Boolean> p : 
xPathFactoryFeatures.entrySet()) {
-                    factory.setFeature(p.getKey(), p.getValue());
-                }
-                if (secure != null) {
-                    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, 
secure.booleanValue());
+                    xpFactory.setFeature(p.getKey(), p.getValue());
                 }
-                return factory.newXPath().evaluate(xpath, doc);
+                xpFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, 
secure);
+                return xpFactory.newXPath().evaluate(xpath, doc);
             }
         } catch (final Exception e) {
             throw new IllegalArgumentException(e);

Reply via email to