Java Code Examples for java.security.NoSuchAlgorithmException.getCause()

The following are Jave code examples for showing how to use getCause() of the java.security.NoSuchAlgorithmException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: OpenJSharp   File: CertStore.java   View Source Code Vote up 5 votes
private static CertStore handleException(NoSuchAlgorithmException e)
        throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
    Throwable cause = e.getCause();
    if (cause instanceof InvalidAlgorithmParameterException) {
        throw (InvalidAlgorithmParameterException)cause;
    }
    throw e;
}
 
Example 2
Project: OpenJSharp   File: Configuration.java   View Source Code Vote up 5 votes
private static Configuration handleException(NoSuchAlgorithmException nsae)
            throws NoSuchAlgorithmException {
    Throwable cause = nsae.getCause();
    if (cause instanceof IllegalArgumentException) {
        throw (IllegalArgumentException)cause;
    }
    throw nsae;
}
 
Example 3
Project: jdk8u-jdk   File: CertStore.java   View Source Code Vote up 5 votes
private static CertStore handleException(NoSuchAlgorithmException e)
        throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
    Throwable cause = e.getCause();
    if (cause instanceof InvalidAlgorithmParameterException) {
        throw (InvalidAlgorithmParameterException)cause;
    }
    throw e;
}
 
Example 4
Project: jdk8u-jdk   File: Configuration.java   View Source Code Vote up 5 votes
private static Configuration handleException(NoSuchAlgorithmException nsae)
            throws NoSuchAlgorithmException {
    Throwable cause = nsae.getCause();
    if (cause instanceof IllegalArgumentException) {
        throw (IllegalArgumentException)cause;
    }
    throw nsae;
}
 
Example 5
Project: jdk8u-jdk   File: Utils.java   View Source Code Vote up 5 votes
static TerminalFactory getTerminalFactory(String provName) throws Exception {
    try {
        TerminalFactory factory = (provName == null)
                ? TerminalFactory.getInstance("PC/SC", null)
                : TerminalFactory.getInstance("PC/SC", null, provName);
        System.out.println(factory);
        return factory;
    } catch (NoSuchAlgorithmException e) {
        Throwable cause = e.getCause();
        if (cause != null && cause.getMessage().startsWith("PC/SC not available")) {
            return null;
        }
        throw e;
    }
}
 
Example 6
Project: jdk8u-jdk   File: Utils.java   View Source Code Vote up 5 votes
static CardTerminal getTerminal(String[] args, String provider) throws Exception {
    setLibrary(args);

    try {
        TerminalFactory factory = (provider == null)
                ? TerminalFactory.getInstance("PC/SC", null)
                : TerminalFactory.getInstance("PC/SC", null, provider);
        System.out.println(factory);

        List<CardTerminal> terminals = factory.terminals().list();
        System.out.println("Terminals: " + terminals);
        if (terminals.isEmpty()) {
            return null;
        }
        CardTerminal terminal = terminals.get(0);

        if (terminal.isCardPresent() == false) {
            System.out.println("*** Insert card");
            if (terminal.waitForCardPresent(20 * 1000) == false) {
                throw new Exception("no card available");
            }
        }
        System.out.println("card present: " + terminal.isCardPresent());

        return terminal;

    } catch (NoSuchAlgorithmException e) {
        Throwable cause = e.getCause();
        if (cause != null && cause.getMessage().startsWith("PC/SC not available")) {
            return null;
        }
        throw e;
    }
}
 
Example 7
Project: openjdk-jdk10   File: CertStore.java   View Source Code Vote up 5 votes
private static CertStore handleException(NoSuchAlgorithmException e)
        throws NoSuchAlgorithmException,
        InvalidAlgorithmParameterException {
    Throwable cause = e.getCause();
    if (cause instanceof InvalidAlgorithmParameterException) {
        throw (InvalidAlgorithmParameterException)cause;
    }
    throw e;
}
 
Example 8
Project: openjdk-jdk10   File: Configuration.java   View Source Code Vote up 5 votes
private static Configuration handleException(NoSuchAlgorithmException nsae)
            throws NoSuchAlgorithmException {
    Throwable cause = nsae.getCause();
    if (cause instanceof IllegalArgumentException) {
        throw (IllegalArgumentException)cause;
    }
    throw nsae;
}
 
Example 9
Project: openjdk-jdk10   File: Utils.java   View Source Code Vote up 5 votes
static TerminalFactory getTerminalFactory(String provName) throws Exception {
    try {
        TerminalFactory factory = (provName == null)
                ? TerminalFactory.getInstance("PC/SC", null)
                : TerminalFactory.getInstance("PC/SC", null, provName);
        System.out.println(factory);
        return factory;
    } catch (NoSuchAlgorithmException e) {
        Throwable cause = e.getCause();
        if (cause != null && cause.getMessage().startsWith("PC/SC not available")) {
            return null;
        }
        throw e;
    }
}
 
Example 10
Project: openjdk-jdk10   File: Utils.java   View Source Code Vote up 5 votes
static CardTerminal getTerminal(String[] args, String provider) throws Exception {
    setLibrary(args);

    try {
        TerminalFactory factory = (provider == null)
                ? TerminalFactory.getInstance("PC/SC", null)
                : TerminalFactory.getInstance("PC/SC", null, provider);
        System.out.println(factory);

        List<CardTerminal> terminals = factory.terminals().list();
        System.out.println("Terminals: " + terminals);
        if (terminals.isEmpty()) {
            return null;
        }
        CardTerminal terminal = terminals.get(0);

        if (terminal.isCardPresent() == false) {
            System.out.println("*** Insert card");
            if (terminal.waitForCardPresent(20 * 1000) == false) {
                throw new Exception("no card available");
            }
        }
        System.out.println("card present: " + terminal.isCardPresent());

        return terminal;

    } catch (NoSuchAlgorithmException e) {
        Throwable cause = e.getCause();
        if (cause != null && cause.getMessage().startsWith("PC/SC not available")) {
            return null;
        }
        throw e;
    }
}