Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6302126

KeyManagerFactory.init method throws unspecified exception for NewSunX509 algorithm

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      generic
    • OS:
      generic

      Description

      The specififcation says that KeyStore parameter may be null and the specification does not
      allow NullPointerException. But the KeyManagerFactory implementation for NewSunX509 algorithm throws NullPointerException if the KeyStore is null.
      Note that SunX509 KeyManagerFactory implementation does not throw any exception in this case.

      To reptoduce this bug, the following example can be used:
      Note the attached keystore should be placed in the current directory in "keystore" file.
      ----------------Test.java-----------------------
      package test;

      import java.security.*;
      import javax.net.ssl.*;

      public class Test {

          public static void main(String[] args) {
              KeyManagerFactory kmf = null;
              char [] password = {' '};

              try {
                  kmf = KeyManagerFactory.getInstance("NewSunX509");
              } catch (NoSuchAlgorithmException nsae) {
                  nsae.printStackTrace();
                  System.out.println("Failed: Unexpected " + nsae);
                  return;
              }

              try {
                  kmf.init((KeyStore)null, password);
                  System.out.println("Passed: OKAY.");
              } catch (KeyStoreException kse) {
                  kse.printStackTrace();
                  System.out.println("Failed: Unexpected " + kse);
              } catch (NoSuchAlgorithmException nsae) {
                  nsae.printStackTrace();
                  System.out.println("Failed: Unexpected " + nsae);
              } catch (UnrecoverableKeyException uke) {
                  uke.printStackTrace();
                  System.out.println("Failed: Unexpected " + uke);
              }
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              xuelei Xue-Lei Fan
              Reporter:
              msokolni Maxim Sokolnikov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: