Code example for CertificateException

0
        if (!(inStream instanceof DataInputStream)) {
            throw new CertificateException("Incorrect inputstream");
        } 
        Iterator<String> it = engineGetCertPathEncodings();
        if (!it.hasNext()) {
            throw new CertificateException("There are no CertPath encodings");
        } 
        return engineGenerateCertPath(inStream, it.next());
    } 
 
    public CertPath engineGenerateCertPath(InputStream inStream, String encoding)
            throws CertificateException { 
        if (!(inStream instanceof DataInputStream)) {
            throw new CertificateException("Incorrect inputstream");
        } 
        if (encoding.length() == 0) {
            if (mode) {
                throw new IllegalArgumentException("Encoding is empty");
            } 
        } 
        return null;