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

KeyStoreSpi::engineGetAttributes does not throws KeyStoreException

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P2
    • Resolution: Approved
    • Fix Version/s: 18
    • Component/s: security-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      source
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      No compatibility risk. Instead, this is a specification error.
    • Interface Kind:
      Java API
    • Scope:
      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

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

                Dates

                Created:
                Updated:
                Resolved: