tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From schu...@apache.org
Subject svn commit: r1847416 - /tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/EncryptInterceptor.java
Date Sun, 25 Nov 2018 15:29:35 GMT
Author: schultz
Date: Sun Nov 25 15:29:35 2018
New Revision: 1847416

URL: http://svn.apache.org/viewvc?rev=1847416&view=rev
Log:
Simplify.

Modified:
    tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/EncryptInterceptor.java

Modified: tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/EncryptInterceptor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/EncryptInterceptor.java?rev=1847416&r1=1847415&r2=1847416&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/EncryptInterceptor.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/EncryptInterceptor.java
Sun Nov 25 15:29:35 2018
@@ -344,46 +344,46 @@ public class EncryptInterceptor extends
         /**
          * The fully-specified algorithm e.g. AES/CBC/PKCS5Padding.
          */
-        private String algorithm;
+        private final String algorithm;
 
         /**
          * The size of the initialization vector to use for encryption. This is
          * often, but not always, the same as the block size.
          */
-        private int ivSize;
+        private final int ivSize;
 
         /**
          * The cryptographic provider name.
          */
-        private String providerName;
+        private final String providerName;
 
         /**
          * The secret key to use for encryption and decryption operations.
          */
-        private SecretKeySpec secretKey;
+        private final SecretKeySpec secretKey;
 
         /**
          * A pool of Cipher objects. Ciphers are expensive to create, but not
          * to re-initialize, so we use a pool of them which grows as necessary.
          */
-        private ConcurrentLinkedQueue<Cipher> cipherPool;
+        private final ConcurrentLinkedQueue<Cipher> cipherPool;
 
         /**
          * A pool of SecureRandom objects. Each encrypt operation requires access
          * to a source of randomness. SecureRandom is thread-safe, but sharing a
          * single instance will likely be a bottleneck.
          */
-        private ConcurrentLinkedQueue<SecureRandom> randomPool;
+        private final ConcurrentLinkedQueue<SecureRandom> randomPool;
 
         public EncryptionManager(String algorithm, SecretKeySpec secretKey, String providerName)
             throws NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderException
{
-            setAlgorithm(algorithm);
-            setProviderName(providerName);
-            setSecretKey(secretKey);
+            this.algorithm = algorithm;
+            this.providerName = providerName;
+            this.secretKey = secretKey;
 
             cipherPool = new ConcurrentLinkedQueue<>();
             Cipher cipher = createCipher();
-            setIVSize(cipher.getBlockSize());
+            ivSize = cipher.getBlockSize();
             cipherPool.offer(cipher);
             randomPool = new ConcurrentLinkedQueue<>();
         }
@@ -394,34 +394,18 @@ public class EncryptInterceptor extends
             randomPool.clear();
         }
 
-        private void setAlgorithm(String algorithm) {
-            this.algorithm = algorithm;
-        }
-
         private String getAlgorithm() {
             return algorithm;
         }
 
-        private void setSecretKey(SecretKeySpec secretKey) {
-            this.secretKey = secretKey;
-        }
-
         private SecretKeySpec getSecretKey() {
             return secretKey;
         }
 
-        private void setIVSize(int size) {
-            ivSize = size;
-        }
-
         private int getIVSize() {
             return ivSize;
         }
 
-        private void setProviderName(String provider) {
-            providerName = provider;
-        }
-
         private String getProviderName() {
             return providerName;
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message