[java-metadata-aggregator] branch main updated: Nullability

Ian Young ian at iay.org.uk
Wed Apr 5 15:56:44 UTC 2023


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

iay pushed a commit to branch main
in repository java-metadata-aggregator.

View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=5d452db81ac58445d556376fa9b4643247579eb7

The following commit(s) were added to refs/heads/main by this push:
     new 5d452db  Nullability
5d452db is described below

commit 5d452db81ac58445d556376fa9b4643247579eb7
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Wed Apr 5 16:56:33 2023 +0100

    Nullability
---
 .../net/shibboleth/metadata/validate/x509/MDA183Test.java    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/mda-keylists-rsa/src/test/java/net/shibboleth/metadata/validate/x509/MDA183Test.java b/mda-keylists-rsa/src/test/java/net/shibboleth/metadata/validate/x509/MDA183Test.java
index 23c6a1d..277fd7b 100644
--- a/mda-keylists-rsa/src/test/java/net/shibboleth/metadata/validate/x509/MDA183Test.java
+++ b/mda-keylists-rsa/src/test/java/net/shibboleth/metadata/validate/x509/MDA183Test.java
@@ -39,13 +39,17 @@ public class MDA183Test extends BaseTest {
     /**
      * Computes the OpenSSL digest value for the given modulus.
      *
+     * <p>
+     * Not used in the test, but left here for use in generating new tests.
+     * </p>
+     *
      * @param modulus RSA public modulus to be digested
      * @return value to be compared against the blacklist
      * @throws StageProcessingException if SHA1 digester can not be acquired, or for internal
      *      errors related to {@link ByteArrayOutputStream}
      */
-    @Nonnull
-    private String openSSLDigest(@Nonnull final BigInteger modulus) throws StageProcessingException {
+    @SuppressWarnings("unused")
+    private @Nonnull String openSSLDigest(@Nonnull final BigInteger modulus) throws StageProcessingException {
         try {
             // Acquire a representation of the modulus
             byte[] modulusBytes = modulus.toByteArray();
@@ -79,6 +83,7 @@ public class MDA183Test extends BaseTest {
             final char [] encodedDigest = Hex.encodeHex(bytes, true);
             final String strValue = String.valueOf(encodedDigest);
             final String trimmed = strValue.substring(20);
+            assert trimmed != null;
             //System.out.println("Digest: " + strValue + " trimmed " + trimmed);
             return trimmed;
         } catch (final NoSuchAlgorithmException e) {
@@ -105,7 +110,7 @@ public class MDA183Test extends BaseTest {
         return val;
     }
 
-    private void verifyKey(final KeyStore ks, final String alias,
+    private void verifyKey(final KeyStore ks, final @Nonnull String alias,
             final String password,
             final Validator<X509Certificate> val,
             int expectedKeySize) throws Exception {
@@ -118,6 +123,7 @@ public class MDA183Test extends BaseTest {
         //System.out.println("alias " + alias + " key size " + rKey.getModulus().bitLength());
         //System.out.println("hash " + openSSLDigest(rKey.getModulus()));
         final Certificate cert = ks.getCertificate(alias);
+        assert cert != null;
         final Item<String> item = new MockItem("mock");
         val.validate((X509Certificate)cert, item, alias);
         final List<ErrorStatus> errors = item.getItemMetadata().get(ErrorStatus.class);

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


More information about the commits mailing list