[java-identity-provider] branch main updated: Fix "new" null issues.

Scott Cantor cantor.2 at osu.edu
Tue Apr 16 14:42:36 UTC 2024


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

scantor pushed a commit to branch main
in repository java-identity-provider.

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

The following commit(s) were added to refs/heads/main by this push:
     new 6645ddaf9 Fix "new" null issues.
6645ddaf9 is described below

commit 6645ddaf9125b185c3fe838a67914f654913fbdc
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Apr 16 10:42:33 2024 -0400

    Fix "new" null issues.
---
 .../idp/authn/impl/X509ProxyFilterTest.java        | 23 ++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/X509ProxyFilterTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/X509ProxyFilterTest.java
index 258f2ef1d..fe90a083b 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/X509ProxyFilterTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/X509ProxyFilterTest.java
@@ -158,11 +158,12 @@ public class X509ProxyFilterTest extends BaseAuthenticationContextTest {
         filter.doFilter(
                 request,
                 (ServletResponse) src.getExternalContext().getNativeResponse(),
-                new MockFilterChain());
+                new MockFilterChain()); 
         
-        Assert.assertEquals(1, ((X509Certificate[]) request.getAttribute("jakarta.servlet.request.X509Certificate")).length);
-        Assert.assertEquals("CN=foobar.example.org, O=Internet2",
-                ((X509Certificate[]) request.getAttribute("jakarta.servlet.request.X509Certificate"))[0].getSubjectDN().toString());
+        final X509Certificate[] certs = (X509Certificate[]) request.getAttribute("jakarta.servlet.request.X509Certificate");
+        assert certs != null;
+        Assert.assertEquals(1, certs.length);
+        Assert.assertEquals("CN=foobar.example.org, O=Internet2", certs[0].getSubjectDN().toString());
     }
 
     @SuppressWarnings("deprecation")
@@ -175,11 +176,13 @@ public class X509ProxyFilterTest extends BaseAuthenticationContextTest {
                 request,
                 (ServletResponse) src.getExternalContext().getNativeResponse(),
                 new MockFilterChain());
+
+        final X509Certificate[] certs = (X509Certificate[]) request.getAttribute("jakarta.servlet.request.X509Certificate");
+        assert certs != null;
         
-        Assert.assertEquals(2, ((X509Certificate[]) request.getAttribute("jakarta.servlet.request.X509Certificate")).length);
-        Assert.assertEquals("CN=foobar.example.org, O=Internet2",
-                ((X509Certificate[]) request.getAttribute("jakarta.servlet.request.X509Certificate"))[0].getSubjectDN().toString());
-        Assert.assertEquals("CN=idp.example.org",
-                ((X509Certificate[]) request.getAttribute("jakarta.servlet.request.X509Certificate"))[1].getSubjectDN().toString());
+        Assert.assertEquals(2, certs.length);
+        Assert.assertEquals("CN=foobar.example.org, O=Internet2", certs[0].getSubjectDN().toString());
+        Assert.assertEquals("CN=idp.example.org", certs[1].getSubjectDN().toString());
     }
-}
+
+}
\ No newline at end of file

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


More information about the commits mailing list