< prev index next >

src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java

Print this page

        

@@ -194,12 +194,13 @@
         throws IOException, NoSuchAlgorithmException, CertificateException {
 
         // A new keystore is always created in the primary keystore format
         if (stream == null) {
             try {
-                keystore = primaryKeyStore.newInstance();
-
+                @SuppressWarnings("deprecation")
+                KeyStoreSpi tmp = primaryKeyStore.newInstance();
+                keystore = tmp;
             } catch (InstantiationException | IllegalAccessException e) {
                 // can safely ignore
             }
             type = primaryType;
 

@@ -212,11 +213,13 @@
             // First try the primary keystore then try the secondary keystore
             InputStream bufferedStream = new BufferedInputStream(stream);
             bufferedStream.mark(Integer.MAX_VALUE);
 
             try {
-                keystore = primaryKeyStore.newInstance();
+                @SuppressWarnings("deprecation")
+                KeyStoreSpi tmp = primaryKeyStore.newInstance();
+                keystore = tmp;
                 type = primaryType;
                 keystore.engineLoad(bufferedStream, password);
 
             } catch (Exception e) {
 

@@ -230,11 +233,13 @@
                     // Ignore secondary keystore when no compatibility mode
                     if (!compatModeEnabled) {
                         throw e;
                     }
 
-                    keystore = secondaryKeyStore.newInstance();
+                    @SuppressWarnings("deprecation")
+                    KeyStoreSpi tmp= secondaryKeyStore.newInstance();           
+                    keystore = tmp;
                     type = secondaryType;
                     bufferedStream.reset();
                     keystore.engineLoad(bufferedStream, password);
 
                     if (debug != null) {

@@ -282,11 +287,13 @@
     public boolean engineProbe(InputStream stream) throws IOException {
 
         boolean result = false;
 
         try {
-            keystore = primaryKeyStore.newInstance();
+            @SuppressWarnings("deprecation")
+            KeyStoreSpi tmp = primaryKeyStore.newInstance();
+            keystore = tmp;
             type = primaryType;
             result = keystore.engineProbe(stream);
 
         } catch (Exception e) {
             throw new IOException(e);
< prev index next >