Java 8 KeyException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 KeyException class.

This code example shows how to use the following methods:getCause, getMessage
     * Test for <code>KeyException(Throwable)</code> constructor Assertion: 
     * constructs KeyException when <code>cause</code> is null 
     */ 
    public void testKeyException04() { 
        Throwable cause = null;
        KeyException tE = new KeyException(cause);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    } 
 
    /** 
     * Test for <code>KeyException(Throwable)</code> constructor Assertion: 
     * constructs KeyException when <code>cause</code> is not null 
     */ 
    public void testKeyException05() { 
        KeyException tE = new KeyException(tCause);
        if (tE.getMessage() != null) {
            String toS = tCause.toString();
            String getM = tE.getMessage();
            assertTrue("getMessage() should contain ".concat(toS), (getM
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    public RetrievalMethod newRetrievalMethod(String uri) {
        return newRetrievalMethod(uri, null, null);
    } 
 
    public RetrievalMethod newRetrievalMethod(String uri, String type,
        List transforms) {
        if (uri == null) {
            throw new NullPointerException("uri must not be null");
        } 
        return new DOMRetrievalMethod(uri, type, transforms);
    } 
 
    public X509Data newX509Data(List content) {
        return new DOMX509Data(content);
    } 
 
    public X509IssuerSerial newX509IssuerSerial(String issuerName,
        BigInteger serialNumber) {
        return new DOMX509IssuerSerial(issuerName, serialNumber);
    } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCause, getMessage
     * Test for <code>KeyException(String)</code> constructor Assertion: 
     * constructs KeyException when <code>msg</code> is null 
     */ 
    public void testKeyException03() { 
        String msg = null;
        KeyException tE = new KeyException(msg);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    } 
 
    /** 
     * Test for <code>KeyException(Throwable)</code> constructor Assertion: 
     * constructs KeyException when <code>cause</code> is null 
     */ 
    public void testKeyException04() { 
        Throwable cause = null;
        KeyException tE = new KeyException(cause);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        } else if (key instanceof RSAPublicKey) {
            RSAPublicKey rkey = (RSAPublicKey) key;
            exponent = new DOMCryptoBinary(rkey.getPublicExponent());
            modulus = new DOMCryptoBinary(rkey.getModulus());
        } else { 
            throw new KeyException("unsupported key algorithm: " +
                key.getAlgorithm());
        } 
    } 
 
    /** 
     * Creates a <code>DOMKeyValue</code> from an element. 
     * 
     * @param kvElem a KeyValue element 
     */ 
    public DOMKeyValue(Element kvElem) throws MarshalException {
        Element kvtElem = DOMUtils.getFirstChildElement(kvElem);
        if (kvtElem.getLocalName().equals("DSAKeyValue")) {
            publicKey = unmarshalDSAKeyValue(kvtElem);
        } else if (kvtElem.getLocalName().equals("RSAKeyValue")) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        Exception cause = new Exception(msgs[1]); 
        KeyException dExc = new KeyException(msgs[0], cause); 
        String msg = null; 
        Throwable th = null; 
        return new Object[] { new KeyException(), new KeyException(msg), 
                new KeyException(msgs[1]), 
                new KeyException(new Throwable()), new KeyException(th), 
                new KeyException(msgs[1], dExc) }; 
    } 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    public RetrievalMethod newRetrievalMethod(String uri) {
        return newRetrievalMethod(uri, null, null);
    } 
 
    public RetrievalMethod newRetrievalMethod(String uri, String type,
        List transforms) {
        if (uri == null) {
            throw new NullPointerException("uri must not be null");
        } 
        return new DOMRetrievalMethod(uri, type, transforms);
    } 
 
    public X509Data newX509Data(List content) {
        return new DOMX509Data(content);
    } 
 
    public X509IssuerSerial newX509IssuerSerial(String issuerName,
        BigInteger serialNumber) {
        return new DOMX509IssuerSerial(issuerName, serialNumber);
    } 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        } else if (key instanceof RSAPublicKey) {
            RSAPublicKey rkey = (RSAPublicKey) key;
            exponent = new DOMCryptoBinary(rkey.getPublicExponent());
            modulus = new DOMCryptoBinary(rkey.getModulus());
        } else { 
            throw new KeyException("unsupported key algorithm: " +
                key.getAlgorithm());
        } 
    } 
 
    /** 
     * Creates a <code>DOMKeyValue</code> from an element. 
     * 
     * @param kvElem a KeyValue element 
     */ 
    public DOMKeyValue(Element kvElem) throws MarshalException {
        Element kvtElem = DOMUtils.getFirstChildElement(kvElem);
        if (kvtElem.getLocalName().equals("DSAKeyValue")) {
            publicKey = unmarshalDSAKeyValue(kvtElem);
        } else if (kvtElem.getLocalName().equals("RSAKeyValue")) {
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        Exception cause = new Exception(msgs[1]); 
        KeyException dExc = new KeyException(msgs[0], cause); 
        String msg = null; 
        Throwable th = null; 
        return new Object[] { new KeyException(), new KeyException(msg), 
                new KeyException(msgs[1]), 
                new KeyException(new Throwable()), new KeyException(th), 
                new KeyException(msgs[1], dExc) }; 
    } 
 
    public static void main(String[] args) { 
        junit.textui.TestRunner.run(KeyExceptionTest.class); 
    } 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
     *  
     * @throws KeyException thrown if the key can not be decoded 
     */ 
    public static PrivateKey decodePrivateKey(File key, char[] password) throws KeyException {
        if (!key.exists()) {
            throw new KeyException("Key file " + key.getAbsolutePath() + " does not exist");
        } 
 
        if (!key.canRead()) {
            throw new KeyException("Key file " + key.getAbsolutePath() + " is not readable");
        } 
 
        try { 
            return decodePrivateKey(FileSupport.fileToByteArray(key), password);
        } catch (IOException e) {
            throw new KeyException("Error reading Key file " + key.getAbsolutePath(), e);
        } 
    } 
 
    /** 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 KeyException Methods: