Code example for InvalidAlgorithmParameterException

0
param = PBE.Util.makePBEMacParameters(k, params);
            } 
            else 
            { 
                throw new InvalidAlgorithmParameterException("PBE requires PBE parameters to be set.");
            } 
        } 
        else if (params instanceof IvParameterSpec)
        { 
            param = new ParametersWithIV(new KeyParameter(key.getEncoded()), ((IvParameterSpec)params).getIV());
        } 
        else if (params == null)
        { 
            param = new KeyParameter(key.getEncoded());
        } 
        else 
        { 
            throw new InvalidAlgorithmParameterException("unknown parameter type.");
        }