You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/08/26 14:07:38 UTC

(commons-xml) branch main updated (14ec662 -> fac4969)

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

garydgregory pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/commons-xml.git


    from 14ec662  Merge branch 'main' of https://github.com/apache/commons-xml into main
     new dab6fcc  Javadoc
     new 0634650  Javadoc
     new 658ecf9  Normalize spelling.
     new 4d65cfe  Extract constant.
     new 55ebb4c  FallbackIgnoreURIResolver.newEmptyDocument() now throws HardeningException instead of IllegalStateException.
     new fac4969  Reuse Objects.requireNonNull()

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/commons/xml/FallbackIgnoreEntityResolver2.java    | 4 +++-
 src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java   | 2 +-
 src/main/java/org/apache/commons/xml/HardeningTemplates.java          | 2 +-
 src/main/java/org/apache/commons/xml/HardeningXPath.java              | 4 +---
 src/main/java/org/apache/commons/xml/XPathHardener.java               | 4 ++--
 src/test/java/org/apache/commons/xml/XIncludeTest.java                | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)


(commons-xml) 03/06: Normalize spelling.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/commons-xml.git

commit 658ecf9fb35df91f1ccf4b10d0ee06546a71b9cd
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Aug 26 09:55:14 2026 -0400

    Normalize spelling.
---
 src/test/java/org/apache/commons/xml/XIncludeTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/xml/XIncludeTest.java b/src/test/java/org/apache/commons/xml/XIncludeTest.java
index 0d4d4a0..06ea446 100644
--- a/src/test/java/org/apache/commons/xml/XIncludeTest.java
+++ b/src/test/java/org/apache/commons/xml/XIncludeTest.java
@@ -48,7 +48,7 @@
  *
  * <p>Each case is exercised in both {@code parse="xml"} and {@code parse="text"} modes, and for both DOM and SAX
  * paths. XInclude resolution requires namespace-aware processing; the baseline tests set it explicitly, and the
- * hardened factory tests rely on the underlying JAXP implementation being namespace-aware enough to recognise elements
+ * hardened factory tests rely on the underlying JAXP implementation being namespace-aware enough to recognize elements
  * in the {@code http://www.w3.org/2001/XInclude} namespace.</p>
  */
 class XIncludeTest {


(commons-xml) 05/06: FallbackIgnoreURIResolver.newEmptyDocument() now throws HardeningException instead of IllegalStateException.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/commons-xml.git

commit 55ebb4c58ab4d2a64e98b110db684ad96eed6f34
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Aug 26 10:06:03 2026 -0400

    FallbackIgnoreURIResolver.newEmptyDocument() now throws
    HardeningException instead of IllegalStateException.
    
    Just like the existing
    FallbackIgnoreLSResourceResolver.domImplementationLS().
---
 src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java b/src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java
index 21a4305..72b36d0 100644
--- a/src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java
+++ b/src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java
@@ -59,7 +59,7 @@ private static Document newEmptyDocument() {
         try {
             return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
         } catch (final ParserConfigurationException e) {
-            throw new IllegalStateException(e);
+            throw new HardeningException("A DocumentBuilder cannot be created which satisfies the configuration requested.", e);
         }
     }
 


(commons-xml) 02/06: Javadoc

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/commons-xml.git

commit 0634650b10339e98850e0a003e4c35d843fbb3e3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Aug 26 09:53:30 2026 -0400

    Javadoc
---
 src/main/java/org/apache/commons/xml/HardeningTemplates.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/xml/HardeningTemplates.java b/src/main/java/org/apache/commons/xml/HardeningTemplates.java
index 7706a49..56b339e 100644
--- a/src/main/java/org/apache/commons/xml/HardeningTemplates.java
+++ b/src/main/java/org/apache/commons/xml/HardeningTemplates.java
@@ -66,7 +66,7 @@ final class HardeningTemplates implements Templates {
     }
 
     /**
-     * The wrapped implementation Templates, for factory methods whose implementations cast {@code newTransformer()} to their own type.
+     * Gets the wrapped implementation Templates, for factory methods whose implementations cast {@code newTransformer()} to their own type.
      *
      * @return the wrapped {@link Templates} implementation.
      */


(commons-xml) 06/06: Reuse Objects.requireNonNull()

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/commons-xml.git

commit fac496994092017fee1c8e2734f78bfdf394f6b9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Aug 26 10:07:31 2026 -0400

    Reuse Objects.requireNonNull()
---
 src/main/java/org/apache/commons/xml/HardeningXPath.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/xml/HardeningXPath.java b/src/main/java/org/apache/commons/xml/HardeningXPath.java
index 80eddf6..32b2475 100644
--- a/src/main/java/org/apache/commons/xml/HardeningXPath.java
+++ b/src/main/java/org/apache/commons/xml/HardeningXPath.java
@@ -59,9 +59,7 @@ final class HardeningXPath implements XPath {
      * @throws XPathExpressionException if the source cannot be parsed.
      */
     static Document parse(final InputSource source) throws XPathExpressionException {
-        if (source == null) {
-            throw new NullPointerException("source cannot be null");
-        }
+        Objects.requireNonNull(source, "source");
         try {
             final DocumentBuilderFactory factory = DocumentBuilderHardener.harden(DocumentBuilderFactory.newInstance());
             factory.setNamespaceAware(true);


(commons-xml) 01/06: Javadoc

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/commons-xml.git

commit dab6fccacacda6449a7464d3d345b33e661f965f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Aug 26 09:49:08 2026 -0400

    Javadoc
---
 src/main/java/org/apache/commons/xml/XPathHardener.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/xml/XPathHardener.java b/src/main/java/org/apache/commons/xml/XPathHardener.java
index 9aecc9b..b9d8b44 100644
--- a/src/main/java/org/apache/commons/xml/XPathHardener.java
+++ b/src/main/java/org/apache/commons/xml/XPathHardener.java
@@ -33,7 +33,7 @@
  *         is the XPath counterpart of the Saxon exception in {@link TransformerHardener}, kept as a documented package-prefix exception because the required
  *         hardening surface is reachable only through a vendor API.</li>
  *     <li><strong>FODP</strong> ({@code jdk.xml.overrideDefaultParser}, set to {@code false}): best-effort. On the stock JDK it pins the internal parser lookup to
- *         the bundled SAX parser, blocking a sysprop swap to a third-party parser (defense-in-depth); Xalan rejects the feature and is left unchanged.</li>
+ *         the bundled SAX parser, blocking a system property swap to a third-party parser (defense-in-depth); Xalan rejects the feature and is left unchanged.</li>
  *     <li><strong>FSP</strong> ({@link XMLConstants#FEATURE_SECURE_PROCESSING}): required. It is the only knob both the stock JDK and Xalan XPath engines expose,
  *         and switches on their secure-processing limits. {@link XPathFactory} has no attribute API for finer control.</li>
  *     <li><strong>{@link HardeningXPathFactory}</strong>: required. FSP governs only the engine, not the parser it provisions internally for the
@@ -44,7 +44,7 @@
 final class XPathHardener {
 
     /**
-     * {@code jdk.xml.overrideDefaultParser}: pin to the JDK's bundled SAX parser; defense-in-depth against a sysprop swap to a third-party parser.
+     * {@code jdk.xml.overrideDefaultParser}: pin to the JDK's bundled SAX parser; defense-in-depth against a system property swap to a third-party parser.
      */
     private static final String FEATURE_OVERRIDE_DEFAULT_PARSER = "jdk.xml.overrideDefaultParser";
 


(commons-xml) 04/06: Extract constant.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/commons-xml.git

commit 4d65cfeedb984aff934170881d2895f84df83ccc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Aug 26 09:58:05 2026 -0400

    Extract constant.
---
 .../java/org/apache/commons/xml/FallbackIgnoreEntityResolver2.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/xml/FallbackIgnoreEntityResolver2.java b/src/main/java/org/apache/commons/xml/FallbackIgnoreEntityResolver2.java
index 676f3a5..0b7b774 100644
--- a/src/main/java/org/apache/commons/xml/FallbackIgnoreEntityResolver2.java
+++ b/src/main/java/org/apache/commons/xml/FallbackIgnoreEntityResolver2.java
@@ -55,6 +55,8 @@
  */
 class FallbackIgnoreEntityResolver2 extends DefaultHandler2 {
 
+    private static final byte[] EMPTY = new byte[0];
+
     /**
      * Resolves {@code systemId} against {@code baseURI}.
      *
@@ -114,7 +116,7 @@ protected InputSource onUnresolved(final String name, final String publicId, fin
         if (HardeningException.throwOnUnresolved()) {
             throw new SAXException(HardeningException.forbidden(name, null, publicId, systemId, baseURI));
         }
-        final InputSource empty = new InputSource(new ByteArrayInputStream(new byte[0]));
+        final InputSource empty = new InputSource(new ByteArrayInputStream(EMPTY));
         empty.setPublicId(publicId);
         empty.setSystemId(absolutize(baseURI, systemId));
         return empty;