[java-shib-shared] branch main updated: Add some missing Javadoc and fix some warnings.

Scott Cantor cantor.2 at osu.edu
Fri Apr 4 17:37:41 UTC 2025


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=e6dff40afa3b05c4151cee45bb127d8e2749b59a

The following commit(s) were added to refs/heads/main by this push:
     new e6dff40a Add some missing Javadoc and fix some warnings.
e6dff40a is described below

commit e6dff40afa3b05c4151cee45bb127d8e2749b59a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Apr 4 13:36:59 2025 -0400

    Add some missing Javadoc and fix some warnings.
---
 .../shared/servlet/HttpServletRequestValidator.java      |  2 ++
 .../impl/BasicHttpServletRequestParametersValidator.java |  8 ++++++--
 .../impl/ChainingHttpServletRequestValidator.java        |  7 +++++--
 .../servlet/impl/HttpServletRequestResponseContext.java  | 16 ++++++++--------
 .../servlet/impl/NoOpHttpServletRequestValidator.java    |  2 ++
 5 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/HttpServletRequestValidator.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/HttpServletRequestValidator.java
index 6b2866d7..617a9907 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/HttpServletRequestValidator.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/HttpServletRequestValidator.java
@@ -21,6 +21,8 @@ import jakarta.servlet.http.HttpServletRequest;
 
 /**
  * Interface for a component that validates an {@link HttpServletRequest}.
+ * 
+ * @since 9.1.4
  */
 public interface HttpServletRequestValidator {
     
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/BasicHttpServletRequestParametersValidator.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/BasicHttpServletRequestParametersValidator.java
index cbbc506b..6704380a 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/BasicHttpServletRequestParametersValidator.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/BasicHttpServletRequestParametersValidator.java
@@ -35,6 +35,8 @@ import net.shibboleth.shared.servlet.HttpServletRequestValidator;
 
 /**
  * Component that validates HTTP request parameters for required presence, uniqueness and mutual exclusivity.
+ * 
+ * @since 9.1.4
  */
 public class BasicHttpServletRequestParametersValidator extends AbstractInitializableComponent
         implements HttpServletRequestValidator {
@@ -43,7 +45,7 @@ public class BasicHttpServletRequestParametersValidator extends AbstractInitiali
     @Nonnull private Logger log = LoggerFactory.getLogger(BasicHttpServletRequestParametersValidator.class);
     
     /** Flag indicating whether to enforce the allowed parameters. */
-    private boolean enforceAllowedParameters = false;
+    private boolean enforceAllowedParameters;
     
     /** Allowed parameters. */
     @Nonnull private Set<String> allowedParameters = CollectionSupport.emptySet();
@@ -182,6 +184,7 @@ public class BasicHttpServletRequestParametersValidator extends AbstractInitiali
         }
     }
 
+// Checkstyle: CyclomaticComplexity OFF
     /** {@inheritDoc} */
     public void validate(@Nonnull final HttpServletRequest request) throws ServletException {
         Constraint.isNotNull(request, "HttpServletRequest was null");
@@ -235,5 +238,6 @@ public class BasicHttpServletRequestParametersValidator extends AbstractInitiali
        }
         
     }
-
+// Checkstyle: CyclomaticComplexity ON
+    
 }
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ChainingHttpServletRequestValidator.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ChainingHttpServletRequestValidator.java
index 32372e69..50379624 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ChainingHttpServletRequestValidator.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ChainingHttpServletRequestValidator.java
@@ -34,8 +34,11 @@ import net.shibboleth.shared.servlet.HttpServletRequestValidator;
 
 /**
  * Implementation for a chain of {@link HttpServletRequestValidator}.
+ * 
+ * @since 9.1.4
  */
-public class ChainingHttpServletRequestValidator extends AbstractInitializableComponent implements HttpServletRequestValidator {
+public class ChainingHttpServletRequestValidator extends AbstractInitializableComponent
+        implements HttpServletRequestValidator {
    
     /** Logger. */
     private Logger log = LoggerFactory.getLogger(ChainingHttpServletRequestValidator.class);
@@ -76,7 +79,7 @@ public class ChainingHttpServletRequestValidator extends AbstractInitializableCo
         for (final HttpServletRequestValidator validator : getValidators()) {
             try {
                 validator.validate(request);
-            } catch (ServletException e) {
+            } catch (final ServletException e) {
                 log.debug("Request failed validation for validator: {}", validator.getClass().getName());
                 throw e;
             }
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/HttpServletRequestResponseContext.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/HttpServletRequestResponseContext.java
index 2b15f9a3..dcb98798 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/HttpServletRequestResponseContext.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/HttpServletRequestResponseContext.java
@@ -32,10 +32,10 @@ import net.shibboleth.shared.logic.Constraint;
 public final class HttpServletRequestResponseContext {
 
     /** ThreadLocal storage for request. */
-    @Nonnull private static final ThreadLocal<HttpServletRequest> currentRequest = new ThreadLocal<>();
+    @Nonnull private static final ThreadLocal<HttpServletRequest> CURRENT_REQUEST = new ThreadLocal<>();
 
     /** ThreadLocal storage for response. */
-    @Nonnull private static final ThreadLocal<HttpServletResponse> currentResponse = new ThreadLocal<>();
+    @Nonnull private static final ThreadLocal<HttpServletResponse> CURRENT_RESPONSE = new ThreadLocal<>();
 
     /** Constructor. */
     private HttpServletRequestResponseContext() {
@@ -52,16 +52,16 @@ public final class HttpServletRequestResponseContext {
         Constraint.isNotNull(request, "HttpServletRequest may not be null");
         Constraint.isNotNull(response, "HttpServletResponse may not be null");
 
-        currentRequest.set(request);
-        currentResponse.set(response);
+        CURRENT_REQUEST.set(request);
+        CURRENT_RESPONSE.set(response);
     }
 
     /**
      * Clear the current thread-local context instances.
      */
     public static void clearCurrent() {
-        currentRequest.remove();
-        currentResponse.remove();
+        CURRENT_REQUEST.remove();
+        CURRENT_RESPONSE.remove();
     }
 
     /**
@@ -70,7 +70,7 @@ public final class HttpServletRequestResponseContext {
      * @return the current request
      */
     @Nullable public static HttpServletRequest getRequest() {
-        return currentRequest.get();
+        return CURRENT_REQUEST.get();
     }
 
     /**
@@ -79,7 +79,7 @@ public final class HttpServletRequestResponseContext {
      * @return the current response
      */
     @Nullable public static HttpServletResponse getResponse() {
-        return currentResponse.get();
+        return CURRENT_RESPONSE.get();
     }
 
 }
\ No newline at end of file
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/NoOpHttpServletRequestValidator.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/NoOpHttpServletRequestValidator.java
index b611ea6f..e7179af6 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/NoOpHttpServletRequestValidator.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/NoOpHttpServletRequestValidator.java
@@ -22,6 +22,8 @@ import net.shibboleth.shared.servlet.HttpServletRequestValidator;
 
 /**
  * Implementation of {@link HttpServletRequestValidator} which is always valid.
+ * 
+ * @since 9.1.4
  */
 public class NoOpHttpServletRequestValidator implements HttpServletRequestValidator {
 

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


More information about the commits mailing list