In JCA/JCE providers that are implemented on top of hardware token, any communication with that token may result in an error. For example, imagine a Smartcard based provider using a card that is physically removed from the reader in the middle of an operation. Or assume we want to store a key on the token, but there is insufficient memory, for example due to other threads concurrently creating objects.
The JCA/JCE APIs currently do not specify how to handle this situation. We plan to amend the specification of Provider to state that ProviderException (or a subclass) should be used for this purpose (ProviderException is an existing subclass of RuntimeException). Also, update the specification of ProviderException to explicitly mention internal errors.
This work is part of Tiger TOO 4635083.