Java Code Examples for org.osgl.exception.UnexpectedException#getCause()

The following examples show how to use org.osgl.exception.UnexpectedException#getCause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppCrypto.java    From actframework with Apache License 2.0 5 votes vote down vote up
/**
 * Returns encrypted message.
 *
 * Note this method uses {@link act.conf.AppConfigKey#SECRET confiured application secret}
 *
 * @param message the message to be encrypted
 * @return the encrypted message
 */
public String encrypt(String message) {
    try {
        return Crypto.encryptAES(message, secret);
    } catch (UnexpectedException e) {
        Throwable cause = e.getCause();
        if (cause instanceof InvalidKeyException) {
            LOGGER.error("Cannot encrypt/decrypt! Please download Java Crypto Extension pack from Oracle: http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136007.html");
        }
        throw e;
    }
}
 
Example 2
Source File: AppCrypto.java    From actframework with Apache License 2.0 5 votes vote down vote up
/**
 * Returns decrypted message.
 *
 * Note this method uses {@link act.conf.AppConfigKey#SECRET confiured application secret}
 *
 * @param message the message to be decrypted.
 * @return the decrypted message.
 */
public String decrypt(String message) {
    try {
        return Crypto.decryptAES(message, secret);
    } catch (UnexpectedException e) {
        Throwable cause = e.getCause();
        if (cause instanceof InvalidKeyException) {
            LOGGER.error("Cannot encrypt/decrypt! Please download Java Crypto Extension pack from Oracle: http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136007.html");
        }
        throw e;
    }
}