Example usage for javax.crypto NoSuchPaddingException toString

List of usage examples for javax.crypto NoSuchPaddingException toString

Introduction

In this page you can find the example usage for javax.crypto NoSuchPaddingException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:uk.co.modularaudio.service.configuration.impl.ConfigurationServiceImpl.java

@Override
public void init() throws ComponentConfigurationException {

    if (configFilePath != null) {
        if (logWhereConfigComesFrom) {
            if (log.isInfoEnabled()) {
                log.info("ConfigurationServiceImpl beginning. Will use '" + configFilePath + "'"); // NOPMD by dan on 02/02/15 11:51
            }/*from ww  w .  j  a va  2  s  .co m*/
        }
        parseOneFilePath(configFilePath);

        if (additionalFilePaths != null && additionalFilePaths.length > 0) {
            for (final String additionalFilePath : additionalFilePaths) {
                parseOneFilePath(additionalFilePath);
            }
        }
    } else if (configResourcePath != null) {
        if (logWhereConfigComesFrom) {
            if (log.isInfoEnabled()) {
                log.info("ConfigurationServiceImpl beginning. Will use '" + configResourcePath + "'"); // NOPMD by dan on 02/02/15 11:51
            }
        }
        parseOneResourcePath(configResourcePath);

        if (additionalResourcePaths != null && additionalResourcePaths.length > 0) {
            for (final String additionalResourcePath : additionalResourcePaths) {
                parseOneResourcePath(additionalResourcePath);
            }
        }
    } else {
    }

    if (useEncryption && encryptionPepper != null) {
        try {
            // Initialise the secret key with our pepper (its not salt,
            // since salt should be added to taste i.e. random).
            final byte keyAsBytes[] = Base64.decodeBase64(encryptionPepper);

            keySpec = new SecretKeySpec(keyAsBytes, ALGO_TYPE);
            cipher = Cipher.getInstance(ALGO_TYPE);
        } catch (final NoSuchAlgorithmException nsae) {
            final String msg = "Unable to initialise config key decryption: " + nsae.toString();
            log.error(msg, nsae);
            throw new ComponentConfigurationException(msg, nsae);
        } catch (final NoSuchPaddingException nspe) {
            final String msg = "Unable to initialise config key decryption: " + nspe.toString();
            log.error(msg, nspe);
            throw new ComponentConfigurationException(msg, nspe);
        }
    } else if (useEncryption) {
        throw new ComponentConfigurationException("No encryption key specified yet component expected one");
    }
}