[java-opensaml] branch maint-3.4 updated: OSJ-263 - HTTPRequestValidationHandler content-type setter bug

Scott Cantor cantor.2 at osu.edu
Fri Apr 5 13:14:03 EDT 2019


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

scantor pushed a commit to branch maint-3.4
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=c0f71ebf78fc564da3097dda9b0a6e1322bf3f42

The following commit(s) were added to refs/heads/maint-3.4 by this push:
       new  c0f71eb   OSJ-263 - HTTPRequestValidationHandler content-type setter bug
c0f71eb is described below

commit c0f71ebf78fc564da3097dda9b0a6e1322bf3f42
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jan 24 20:49:18 2019 -0500

    OSJ-263 - HTTPRequestValidationHandler content-type setter bug
    
    https://issues.shibboleth.net/jira/browse/OSJ-263
---
 .../messaging/handler/impl/HTTPRequestValidationHandler.java | 12 +++++++-----
 .../handler/impl/HTTPRequestValidationHandlerTest.java       |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/opensaml-messaging-impl/src/main/java/org/opensaml/messaging/handler/impl/HTTPRequestValidationHandler.java b/opensaml-messaging-impl/src/main/java/org/opensaml/messaging/handler/impl/HTTPRequestValidationHandler.java
index e783ea1..961a658 100644
--- a/opensaml-messaging-impl/src/main/java/org/opensaml/messaging/handler/impl/HTTPRequestValidationHandler.java
+++ b/opensaml-messaging-impl/src/main/java/org/opensaml/messaging/handler/impl/HTTPRequestValidationHandler.java
@@ -17,8 +17,11 @@
 
 package org.opensaml.messaging.handler.impl;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import javax.servlet.http.HttpServletRequest;
 
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -36,19 +39,19 @@ import org.slf4j.LoggerFactory;
 public class HTTPRequestValidationHandler extends AbstractMessageHandler {
 
     /** Class logger. */
-    private final Logger log = LoggerFactory.getLogger(HTTPRequestValidationHandler.class);
+    @Nonnull private final Logger log = LoggerFactory.getLogger(HTTPRequestValidationHandler.class);
 
     /** Expected content type of the request. */
-    private String requiredContentType;
+    @Nullable private String requiredContentType;
 
     /** Expected method of the request. */
-    private String requiredRequestMethod;
+    @Nullable private String requiredRequestMethod;
 
     /** Whether the request must be secure. */
     private boolean requireSecured;
     
     /** The HTTP servlet request being evaluated. */
-    private HttpServletRequest httpServletRequest;
+    @NonnullAfterInit private HttpServletRequest httpServletRequest;
 
     /**
      * Get the required content type.
@@ -67,7 +70,6 @@ public class HTTPRequestValidationHandler extends AbstractMessageHandler {
     public void setRequiredContentType(final String contentType) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
         requiredContentType = contentType;
-        requiredRequestMethod = StringSupport.trimOrNull(contentType);
     }
 
     /**
diff --git a/opensaml-messaging-impl/src/test/java/org/opensaml/messaging/handler/impl/HTTPRequestValidationHandlerTest.java b/opensaml-messaging-impl/src/test/java/org/opensaml/messaging/handler/impl/HTTPRequestValidationHandlerTest.java
index 1a29158..a6919e5 100644
--- a/opensaml-messaging-impl/src/test/java/org/opensaml/messaging/handler/impl/HTTPRequestValidationHandlerTest.java
+++ b/opensaml-messaging-impl/src/test/java/org/opensaml/messaging/handler/impl/HTTPRequestValidationHandlerTest.java
@@ -49,8 +49,8 @@ public class HTTPRequestValidationHandlerTest {
         
         handler = new HTTPRequestValidationHandler();
         handler.setHttpServletRequest(httpRequest);
-        handler.setRequiredContentType(contentType);
         handler.setRequiredRequestMethod(method);
+        handler.setRequiredContentType(contentType);
         handler.setRequireSecured(true);
         handler.initialize();
     }

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


More information about the commits mailing list