@@ -515,12 +515,12 @@ private static Transform getTransform(Service s,
515515 * transformation
516516 *
517517 * @throws NoSuchAlgorithmException if {@code transformation}
518- * is {@code null}, empty, in an invalid format,
519- * or if no provider supports a {@code CipherSpi}
520- * implementation for the specified algorithm
518+ * is {@code null}, empty or in an invalid format;
519+ * or if a {@code CipherSpi} implementation is not found or
520+ * is found but does not support the mode
521521 *
522- * @throws NoSuchPaddingException if {@code transformation}
523- * contains a padding scheme that is not available
522+ * @throws NoSuchPaddingException if a {@code CipherSpi} implementation
523+ * is found but does not support the padding scheme
524524 *
525525 * @see java.security.Provider
526526 */
@@ -573,17 +573,21 @@ public static final Cipher getInstance(String transformation)
573573 failure = e ;
574574 }
575575 }
576+ if (failure instanceof NoSuchPaddingException nspe ) {
577+ throw nspe ;
578+ }
576579 throw new NoSuchAlgorithmException
577- ("Cannot find any provider supporting " + transformation , failure );
580+ ("Cannot find any provider supporting " + transformation ,
581+ failure );
578582 }
579583
580584 /**
581585 * Returns a {@code Cipher} object that implements the specified
582586 * transformation.
583587 *
584588 * <p> A new {@code Cipher} object encapsulating the
585- * {@code CipherSpi} implementation from the specified provider
586- * is returned. The specified provider must be registered
589+ * {@code CipherSpi} implementation from the specified {@code provider}
590+ * is returned. The specified {@code provider} must be registered
587591 * in the security provider list.
588592 *
589593 * <p> Note that the list of registered providers may be retrieved via
@@ -625,15 +629,16 @@ public static final Cipher getInstance(String transformation)
625629 * is {@code null} or empty
626630 *
627631 * @throws NoSuchAlgorithmException if {@code transformation}
628- * is {@code null}, empty, in an invalid format,
629- * or if a {@code CipherSpi} implementation for the
630- * specified algorithm is not available from the specified
631- * provider
632+ * is {@code null}, empty or in an invalid format;
633+ * or if a {@code CipherSpi} implementation from the specified
634+ * {@code provider} is not found or is found but does not support
635+ * the mode
632636 *
633- * @throws NoSuchPaddingException if {@code transformation}
634- * contains a padding scheme that is not available
637+ * @throws NoSuchPaddingException if a {@code CipherSpi} implementation
638+ * from the specified {@code provider} is found but does not
639+ * support the padding scheme
635640 *
636- * @throws NoSuchProviderException if the specified provider is not
641+ * @throws NoSuchProviderException if the specified {@code provider} is not
637642 * registered in the security provider list
638643 *
639644 * @see java.security.Provider
@@ -706,13 +711,14 @@ private String getProviderName() {
706711 * is {@code null}
707712 *
708713 * @throws NoSuchAlgorithmException if {@code transformation}
709- * is {@code null}, empty, in an invalid format,
710- * or if a {@code CipherSpi} implementation for the
711- * specified algorithm is not available from the specified
712- * {@code provider} object
713- *
714- * @throws NoSuchPaddingException if {@code transformation}
715- * contains a padding scheme that is not available
714+ * is {@code null}, empty or in an invalid format;
715+ * or if a {@code CipherSpi} implementation from the specified
716+ * {@code provider} is not found or is found but does not support
717+ * the mode
718+ *
719+ * @throws NoSuchPaddingException if a {@code CipherSpi} implementation
720+ * from the specified {@code provider} is found but does not
721+ * support the padding scheme
716722 *
717723 * @see java.security.Provider
718724 */
0 commit comments