[java-shib-shared] branch main updated: Null cleanup.

Scott Cantor cantor.2 at osu.edu
Thu Dec 8 19:06:55 UTC 2022


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=7b1879b21a64064578d5cc825887c6898637d17d

The following commit(s) were added to refs/heads/main by this push:
     new 7b1879b2 Null cleanup.
7b1879b2 is described below

commit 7b1879b21a64064578d5cc825887c6898637d17d
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Dec 8 14:06:52 2022 -0500

    Null cleanup.
---
 .../net/shibboleth/shared/xml/impl/BasicParserPool.java  | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
index 19e3e5bc..373bf50d 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
@@ -127,10 +127,10 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
     private boolean xincludeAware;
 
     /** Entity resolver used by builders. */
-    private EntityResolver entityResolver;
+    @Nullable private EntityResolver entityResolver;
 
     /** Error handler used by builders. */
-    private ErrorHandler errorHandler;
+    @Nonnull private ErrorHandler errorHandler;
 
     /** Constructor. */
     public BasicParserPool() {
@@ -168,12 +168,8 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
             builder = createBuilder();
         }
 
-        if (builder != null) {
-            prepareBuilder(builder);
-            return new DocumentBuilderProxy(builder, this);
-        }
-
-        throw new XMLParserException("Unable to obtain a DocumentBuilder");
+        prepareBuilder(builder);
+        return new DocumentBuilderProxy(builder, this);
     }
 
 //CheckStyle: ReturnCount OFF
@@ -587,9 +583,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
         checkComponentActive();
 
         try {
-            final DocumentBuilder builder = builderFactory.newDocumentBuilder();
-
-            return builder;
+            return Constraint.isNotNull(builderFactory.newDocumentBuilder(), "Builder factory did not return builder");
         } catch (final ParserConfigurationException e) {
             log.debug("Unable to create new document builder: {}", e.getMessage());
             throw new XMLParserException("Unable to create new document builder", e);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list