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 <[email protected]>
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);

Reply via email to