8223555: Cleanups in cacerts tests
authorclanger
Fri, 10 May 2019 06:31:09 +0100
changeset 54803 293d45e5108b
parent 54802 b0a1572ec64a
child 54804 6870b259b170
8223555: Cleanups in cacerts tests Reviewed-by: xuelei
test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ValidatePathWithParams.java
test/jdk/sun/security/lib/cacerts/VerifyCACerts.java
--- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ValidatePathWithParams.java	Fri May 10 09:39:49 2019 +0800
+++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/ValidatePathWithParams.java	Fri May 10 06:31:09 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -253,7 +253,7 @@
         }
 
         // Generate CertPath with certsToValidate
-        ArrayList<X509Certificate> certs = new ArrayList();
+        ArrayList<X509Certificate> certs = new ArrayList<>();
         for (String cert : certsToValidate) {
             if (cert != null) {
                 certs.add(getCertificate(cert));
--- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java	Fri May 10 09:39:49 2019 +0800
+++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java	Fri May 10 06:31:09 2019 +0100
@@ -32,8 +32,15 @@
 import java.io.FileInputStream;
 import java.security.KeyStore;
 import java.security.MessageDigest;
-import java.security.cert.*;
-import java.util.*;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.X509Certificate;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
 
 public class VerifyCACerts {
 
@@ -45,8 +52,8 @@
     private static final int COUNT = 92;
 
     // map of cert alias to SHA-256 fingerprint
-    private static final Map<String, String> FINGERPRINT_MAP
-            = new HashMap<String, String>() {
+    @SuppressWarnings("serial")
+    private static final Map<String, String> FINGERPRINT_MAP = new HashMap<>() {
         {
             put("actalisauthenticationrootca [jdk]",
                     "55:92:60:84:EC:96:3A:64:B9:6E:2A:BE:01:CE:0B:A8:6A:64:FB:FE:BC:C7:AA:B5:AF:C1:55:B3:7F:D7:60:66");
@@ -237,6 +244,7 @@
 
     // Exception list to 90 days expiry policy
     // No error will be reported if certificate in this list expires
+    @SuppressWarnings("serial")
     private static final HashSet<String> EXPIRY_EXC_ENTRIES = new HashSet<>() {
         {
             // Valid until: Sat Jul 06 19:59:59 EDT 2019