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

KeyStoreSpi::engineStore(LoadStoreParameter) spec mismatch to its behavior

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 17
    • Component/s: security-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Update the documentation comment in KeyStoreSpi.engineStore(KeyStore.LoadStoreParameter param) and in KeyStore.store(KeyStore.LoadStoreParameter param) to state that they can throw UnsupportedOperationException.

      Problem

      The KeystoreSpi.engineStore(KeyStore.LoadStoreParameter param) may throw UnsupportedOperationException if the implementation does not support engineStore() operation. The KeyStore.store(KeyStore.LoadStoreParameter param) can throw UnsupportedOperationException as it invokes KeystoreSpi.engineStore(KeyStore.LoadStoreParameter param). However, the comments for both methods do not document that UnsupportedOperationException can be thrown.

      Solution

      The documentation comment in KeyStoreSpi.engineStore(KeyStore.LoadStoreParameter param) and KeyStore.store(KeyStore.LoadStoreParameter param) should be improved to state that UnsupportedOperationException can be thrown. Appropriate javadoc tags @implSpec and @throws are added for description of UnsupportedOperationException.

      Specification

      The following spec change is made to engineStore(KeyStore.LoadStoreParameter param) in KeyStoreSpi class:

          /**
           * Stores this keystore using the given
           * {@code KeyStore.LoadStoreParameter}.
           *
      +    * @implSpec The default implementation throws
      +    *          an {@link UnsupportedOperationException}.
           *
           * @param param the {@code KeyStore.LoadStoreParameter}
           *          that specifies how to store the keystore,
           *          which may be {@code null}
           *
           * @throws    IllegalArgumentException if the given
           *          {@code KeyStore.LoadStoreParameter}
           *          input is not recognized
           * @throws    IOException if there was an I/O problem with data
           * @throws    NoSuchAlgorithmException if the appropriate data integrity
           *          algorithm could not be found
           * @throws    CertificateException if any of the certificates included in
           *          the keystore data could not be stored
      +    * @throws    UnsupportedOperationException if the implementation does
      +    *          not support this operation
           *
           * @since 1.5
           */
          public void engineStore(KeyStore.LoadStoreParameter param)
                      throws IOException, NoSuchAlgorithmException,
                      CertificateException

      The following spec change is made to store(KeyStore.LoadStoreParameter param) in KeyStore class:

          /**
           * Stores this keystore using the given {@code LoadStoreParameter}.
           *
           * @param param the {@code LoadStoreParameter}
           *          that specifies how to store the keystore,
           *          which may be {@code null}
           *
           * @throws    IllegalArgumentException if the given
           *          {@code LoadStoreParameter}
           *          input is not recognized
           * @throws    KeyStoreException if the keystore has not been initialized
           *          (loaded)
           * @throws    IOException if there was an I/O problem with data
           * @throws    NoSuchAlgorithmException if the appropriate data integrity
           *          algorithm could not be found
           * @throws    CertificateException if any of the certificates included in
           *          the keystore data could not be stored
      +    * @throws    UnsupportedOperationException if this operation is not supported
           *
           * @since 1.5
           */
          public final void store(LoadStoreParameter param)
                      throws KeyStoreException, IOException,
                      NoSuchAlgorithmException, CertificateException

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              hchao Haimay Chao
              Reporter:
              kganapureddy Krushnareddy Ganapureddy
              Reviewed By:
              Jamil Nimeh, Sean Mullan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: