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

KeyStoreSpi::engineGetAttributes does not throws KeyStoreException

    XMLWordPrintable

Details

    • CSR
    • Status: Closed
    • P2
    • Resolution: Approved
    • 18
    • security-libs
    • None
    • source
    • low
    • No compatibility risk. Instead, this is a specification error.
    • Java API
    • SE

    Description

      Summary

      KeyStoreException is not thrown by KeyStoreSpi::engineGetAttributes but the specification claims it could. The @throws line should be removed.

      Problem

      The method specification is wrong that a KeyStoreException could be thrown, but it shouldn't. The line was copied from KeyStore::getAttributes but the check is already done inside that method and thus the keystore is guaranteed to have been initialized in this method.

      Solution

      Remove the @throws line.

      Specification

      In src/java.base/share/classes/java/security/KeyStore.java:

           /*
            ....
      -     * @throws KeyStoreException if the keystore has not been initialized
      -     * (loaded).
      -     *
            * @since 18
            */
           public Set<Entry.Attribute> engineGetAttributes(String alias);

      Attachments

        Issue Links

          Activity

            People

              weijun Weijun Wang
              weijun Weijun Wang
              Sean Mullan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: