Code example for KeyStoreException

0
 
    protected void engineInit(KeyStore ks, char[] password)
            throws KeyStoreException, NoSuchAlgorithmException, 
            UnrecoverableKeyException { 
        if (password == null) {
            throw new KeyStoreException("Incorrect password");
        } 
        if (ks == null) {
            throw new UnrecoverableKeyException("Incorrect keystore");
        } 
    } 
 
    protected void engineInit(ManagerFactoryParameters spec)
            throws InvalidAlgorithmParameterException { 
        if (spec == null) {
            throw new InvalidAlgorithmParameterException("Incorrect parameter");
        } 
        if (spec instanceof Parameters) {
            try { 
                engineInit(((Parameters)spec).getKeyStore(),
                        ((Parameters)spec).getPassword());