@VisibleForTesting void createEncryptors(String password) { if (password == null) { throw new ValidationException( "may not be null - " + this.getClass().getName() + ".password = null" ); } final PooledPBEByteEncryptor pooledPBEByteEncryptor = new PooledPBEByteEncryptor(); pooledPBEByteEncryptor.setPasswordCharArray(password.toCharArray()); pooledPBEByteEncryptor.setPoolSize(Runtime.getRuntime().availableProcessors()); this.byteEncryptor = pooledPBEByteEncryptor; final PooledPBEStringEncryptor pooledStringEncryptor = new PooledPBEStringEncryptor(); pooledStringEncryptor.setPasswordCharArray(password.toCharArray()); pooledStringEncryptor.setPoolSize(Runtime.getRuntime().availableProcessors()); this.stringEncryptor = pooledStringEncryptor; // Dereference the password so it will get garbage collected and moved // out of memory as an immutable String. this.password = null; }
encryptor = new PooledPBEByteEncryptor(); } else if (this.encryptorType == ENCRYPTOR_TYPE_STRING) { encryptor = new PooledPBEStringEncryptor();
/** * <p> * Sets the size of the pool of digesters to be created. * </p> * <p> * This parameter is <b>required</b>. * </p> * * @param poolSize size of the pool */ public synchronized void setPoolSize(final int poolSize) { CommonUtils.validateIsTrue(poolSize > 0, "Pool size be > 0"); if (isInitialized()) { throw new AlreadyInitializedException(); } this.poolSize = poolSize; this.poolSizeSet = true; }
encryptor = new PooledPBEByteEncryptor(); } else if (this.encryptorType == ENCRYPTOR_TYPE_STRING) { encryptor = new PooledPBEStringEncryptor();
/** * <p> * Sets the size of the pool of digesters to be created. * </p> * <p> * This parameter is <b>required</b>. * </p> * * @param poolSize size of the pool */ public synchronized void setPoolSize(final int poolSize) { CommonUtils.validateIsTrue(poolSize > 0, "Pool size be > 0"); if (isInitialized()) { throw new AlreadyInitializedException(); } this.poolSize = poolSize; this.poolSizeSet = true; }
if (!isInitialized()) { initialize();
encryptor = new PooledPBEByteEncryptor(); } else if (this.encryptorType == ENCRYPTOR_TYPE_STRING) { encryptor = new PooledPBEStringEncryptor();
/** * <p> * Sets the size of the pool of digesters to be created. * </p> * <p> * This parameter is <b>required</b>. * </p> * * @param poolSize size of the pool */ public synchronized void setPoolSize(final int poolSize) { CommonUtils.validateIsTrue(poolSize > 0, "Pool size be > 0"); if (isInitialized()) { throw new AlreadyInitializedException(); } this.poolSize = poolSize; this.poolSizeSet = true; }
if (!isInitialized()) { initialize();
if (!isInitialized()) { initialize();
if (!isInitialized()) { initialize();