[java-opensaml] branch main updated: IDP-2069 - Null Handling Task

Rod Widdowson rdw at steadingsoftware.com
Mon Apr 10 14:07:36 UTC 2023


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

rdw pushed a commit to branch main
in repository java-opensaml.

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

The following commit(s) were added to refs/heads/main by this push:
     new 43d465450 IDP-2069 - Null Handling Task
43d465450 is described below

commit 43d465450d9eaee49ebc27dbd55c2fe8496dfba3
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Apr 10 15:07:30 2023 +0100

    IDP-2069 - Null Handling Task
    
    https://shibboleth.atlassian.net/browse/IDP-2069
    
    Add a predicate to see if doPreInvoke has been called
---
 .../messaging/handler/AbstractMessageHandler.java      | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/opensaml-messaging-api/src/main/java/org/opensaml/messaging/handler/AbstractMessageHandler.java b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/handler/AbstractMessageHandler.java
index 162434300..52049f926 100644
--- a/opensaml-messaging-api/src/main/java/org/opensaml/messaging/handler/AbstractMessageHandler.java
+++ b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/handler/AbstractMessageHandler.java
@@ -43,6 +43,9 @@ public abstract class AbstractMessageHandler extends AbstractInitializableCompon
     /** Condition dictating whether to run or not. */
     @Nonnull private Predicate<MessageContext> activationCondition;
     
+    /** Has {@link #doPostInvoke(MessageContext)} been called?. Only ever set to true */
+    private boolean preInvokeCalled;
+
     /** Constructor. */
     public AbstractMessageHandler() {
         activationCondition = PredicateSupport.alwaysTrue();
@@ -87,6 +90,7 @@ public abstract class AbstractMessageHandler extends AbstractInitializableCompon
         // error object using the Java 7 API.
 
         if (doPreInvoke(messageContext)) {
+            preInvokeCalled = true;
             try {
                 doInvoke(messageContext);
             } catch (final MessageHandlerException e) {
@@ -195,6 +199,20 @@ public abstract class AbstractMessageHandler extends AbstractInitializableCompon
         doPostInvoke(messageContext);
     }
 
+    /**
+     * Has the {@link #doPreInvoke(MessageContext)} method been entirely called?
+     *
+     * Note the unsynchronized access.  The underlying field is only ever set true, so if true is
+     * returned it is correct, if false is returned is is not safe to make any assumptions (even if
+     * there was an call in flight.
+     *
+     * @since 5.0.0
+     */
+    protected boolean isPreInvokeCalled() {
+        return preInvokeCalled;
+    }
+
+
     /**
      * Return a prefix for logging messages for this component.
      * 

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


More information about the commits mailing list