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-secure-xml.git


The following commit(s) were added to refs/heads/main by this push:
     new 554e567  Add inline comments
554e567 is described below

commit 554e5673745685642b02f649fbf0a67538b9b1cf
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Aug 31 10:34:22 2026 -0400

    Add inline comments
    
    Some APIs should never return null for a specification-compliant
    factory.
---
 .../java/org/apache/commons/xml/secure/SecureTransformerFactory.java  | 4 ++++
 src/main/java/org/apache/commons/xml/secure/SecureXPathFactory.java   | 1 +
 2 files changed, 5 insertions(+)

diff --git 
a/src/main/java/org/apache/commons/xml/secure/SecureTransformerFactory.java 
b/src/main/java/org/apache/commons/xml/secure/SecureTransformerFactory.java
index 4634104..744ba85 100644
--- a/src/main/java/org/apache/commons/xml/secure/SecureTransformerFactory.java
+++ b/src/main/java/org/apache/commons/xml/secure/SecureTransformerFactory.java
@@ -221,12 +221,14 @@ public URIResolver getURIResolver() {
          */
         @Override
         public Templates newTemplates(final Source source) throws 
TransformerConfigurationException {
+            // newTemplates() should never return null for a 
specification-compliant factory.
             final Templates templates = 
delegate.newTemplates(SecureSAXParserFactory.secure(source, 
overrideDefaultParser()));
             return templates == null ? null : new SecureTemplates(templates, 
getURIResolver(), emptySource, overrideDefaultParser());
         }
 
         @Override
         public TemplatesHandler newTemplatesHandler() throws 
TransformerConfigurationException {
+            // newTemplatesHandler() should never return null for a 
specification-compliant factory.
             final TemplatesHandler handler = delegate.newTemplatesHandler();
             return handler == null ? null : new 
SecureTemplatesHandler(handler, getURIResolver(), emptySource, 
overrideDefaultParser());
         }
@@ -234,6 +236,7 @@ public TemplatesHandler newTemplatesHandler() throws 
TransformerConfigurationExc
         @Override
         public Transformer newTransformer() throws 
TransformerConfigurationException {
             // Identity transformer: still parses runtime sources, so wrap it 
to secure Transformer.transform(Source, Result).
+            // newTemplatesHandler() should never return null for a 
specification-compliant factory.
             final Transformer transformer = delegate.newTransformer();
             return transformer == null ? null : new 
SecureTransformer(transformer, getURIResolver(), emptySource, 
overrideDefaultParser());
         }
@@ -246,6 +249,7 @@ public Transformer newTransformer() throws 
TransformerConfigurationException {
          */
         @Override
         public Transformer newTransformer(final Source source) throws 
TransformerConfigurationException {
+            // newTemplatesHandler() should never return null for a 
specification-compliant factory.
             final Transformer transformer = 
delegate.newTransformer(SecureSAXParserFactory.secure(source, 
overrideDefaultParser()));
             return transformer == null ? null : new 
SecureTransformer(transformer, getURIResolver(), emptySource, 
overrideDefaultParser());
         }
diff --git 
a/src/main/java/org/apache/commons/xml/secure/SecureXPathFactory.java 
b/src/main/java/org/apache/commons/xml/secure/SecureXPathFactory.java
index b550a07..3c3aa9b 100644
--- a/src/main/java/org/apache/commons/xml/secure/SecureXPathFactory.java
+++ b/src/main/java/org/apache/commons/xml/secure/SecureXPathFactory.java
@@ -81,6 +81,7 @@ public boolean isObjectModelSupported(final String 
objectModel) {
 
         @Override
         public XPath newXPath() {
+            // newXPath() should never return null for a 
specification-compliant factory.
             final XPath xpath = delegate.newXPath();
             return xpath == null ? null : new SecureXPath(xpath, 
overrideDefaultParser());
         }

Reply via email to