[java-identity-provider] branch master updated: IDP-1606 AbstractValidationAction NPEs if a MetricRegistry is not installed

Phil Smart philip.smart at jisc.ac.uk
Fri May 15 09:36:18 UTC 2020


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

philsmart pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=23ae017e1c7106e6e9ca49219586fc6494eece12

The following commit(s) were added to refs/heads/master by this push:
       new  23ae017e1 IDP-1606 AbstractValidationAction NPEs if a MetricRegistry is not installed
23ae017e1 is described below

commit 23ae017e1c7106e6e9ca49219586fc6494eece12
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri May 15 10:28:46 2020 +0100

    IDP-1606 AbstractValidationAction NPEs if a MetricRegistry is not installed
    
    Added a null check before recording success or failure.
    
    https://issues.shibboleth.net/jira/browse/IDP-1606
---
 .../net/shibboleth/idp/authn/AbstractValidationAction.java | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
index b3fce4b1c..f5f208fa7 100644
--- a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
+++ b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
@@ -399,21 +399,27 @@ public abstract class AbstractValidationAction extends AbstractAuthenticationAct
     @Nonnull protected abstract Subject populateSubject(@Nonnull final Subject subject);
     
     /**
-     * Record a successful authentication attempt against the configured counter.
+     * Record a successful authentication attempt against the configured counter. Records
+     * nothing if the metrics registry is not installed into the runtime.
      * 
      * @since 3.3.0
      */
     protected void recordSuccess() {
-        MetricsSupport.getMetricRegistry().counter(getMetricName() + ".successes").inc();
+        if (MetricsSupport.getMetricRegistry() != null) {
+            MetricsSupport.getMetricRegistry().counter(getMetricName() + ".successes").inc();
+        }
     }
     
     /**
-     * Record a failed authentication attempt against the configured counter.
+     * Record a failed authentication attempt against the configured counter. Records
+     * nothing if the metrics registry is not installed into the runtime.
      * 
      * @since 3.3.0
      */
     protected void recordFailure() {
-        MetricsSupport.getMetricRegistry().counter(getMetricName() + ".failures").inc();
+        if (MetricsSupport.getMetricRegistry() != null) {
+            MetricsSupport.getMetricRegistry().counter(getMetricName() + ".failures").inc();
+        }
     }
     
     /**

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


More information about the commits mailing list