oscerd commented on a change in pull request #5069:
URL: https://github.com/apache/camel/pull/5069#discussion_r574274356



##########
File path: 
camel-core/src/main/java/org/apache/camel/converter/stream/CipherPair.java
##########
@@ -61,7 +60,18 @@ public Cipher getEncryptor() {
         return enccipher;
     }
     
+    /**
+     * Create the decryptor every time because the decryptor is not thead 
safe. For example, if you reuse the decryptor
+     * instance in the Multi-cast case then you will get errors.
+     */
     public Cipher getDecryptor() {
-        return deccipher;
+        try {
+            Cipher deccipher = Cipher.getInstance(transformation);
+            deccipher.init(Cipher.DECRYPT_MODE, key, ivp == null ? null : new 
IvParameterSpec(ivp));
+            return deccipher;
+        } catch (GeneralSecurityException e) {
+            // should not happen
+            throw new IllegalStateException("Could not instanciate decryptor, 
e");

Review comment:
       It should be
   
   throw new IllegalStateException("Could not instanciate decryptor", e);




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to