catch (InvalidParameterSpecException e)
catch (NullPointerException e)
    private void basicTest(String algorithm, Class algorithmParameterSpec, byte[] asn1Encoded)        throws Exception    {        AlgorithmParameters alg = AlgorithmParameters.getInstance(algorithm, "BC");        alg.init(asn1Encoded);        try        {            alg.init(asn1Encoded);            fail("encoded re-initialization not detected");        }        catch (IOException e)        {            // expected already initialized        }        AlgorithmParameterSpec spec = alg.getParameterSpec(algorithmParameterSpec);        try        {            alg.init(spec);            fail("spec re-initialization not detected");        }        catch (InvalidParameterSpecException e)        {            // expected already initialized        }        try        {            spec = alg.getParameterSpec(AlgorithmParameterSpec.class);            fail("wrong spec not detected");        }        catch (InvalidParameterSpecException e)        {            // expected unknown object        }        try        {            spec = alg.getParameterSpec(null);            fail("null spec not detected");        }        catch (InvalidParameterSpecException e)        {            // expected unknown object        }        alg = AlgorithmParameters.getInstance(algorithm, "BC");        alg.init(asn1Encoded, "ASN.1");        alg = AlgorithmParameters.getInstance(algorithm, "BC");        alg.init(asn1Encoded, null);        alg = AlgorithmParameters.getInstance(algorithm, "BC");        try        {            alg.init(asn1Encoded, "FRED");            fail("unknown spec not detected");        }        catch (IOException e)        {            // expected already initialized        }    }