You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by co...@apache.org on 2014/12/08 12:37:00 UTC

camel git commit: NPE fix

Repository: camel
Updated Branches:
  refs/heads/master 36e7b6681 -> a8eafc8ec


NPE fix


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a8eafc8e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a8eafc8e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a8eafc8e

Branch: refs/heads/master
Commit: a8eafc8ec82a442fc1909003e44047e855204883
Parents: 36e7b66
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon Dec 8 11:36:48 2014 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Dec 8 11:36:48 2014 +0000

----------------------------------------------------------------------
 .../org/apache/camel/converter/crypto/CryptoDataFormat.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a8eafc8e/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java
index 2b734ad..711b3df 100644
--- a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java
+++ b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java
@@ -175,6 +175,10 @@ public class CryptoDataFormat implements DataFormat {
 
     private void inlineInitVector(OutputStream outputStream, byte[] iv) throws IOException {
         if (inline) {
+            if (iv == null) {
+                throw new IllegalStateException("Inlining cannot be performed, as no initialization vector was specified");
+            }
+
             DataOutputStream dout = new DataOutputStream(outputStream);
             dout.writeInt(iv.length);
             outputStream.write(iv);
@@ -251,7 +255,7 @@ public class CryptoDataFormat implements DataFormat {
      * encrypted ciphertext. When the payload is to be decrypted this
      * initialization vector will need to be read from the stream. Requires that
      * the formatter has been configured with an init vector that is valid for
-     * the give algorithm.
+     * the given algorithm.
      *
      * @param inline true if the initialization vector should be inlined in the stream.
      */