summaryrefslogtreecommitdiffstats
path: root/luni/src/main/java/javax/crypto
diff options
context:
space:
mode:
authorAlex Klyubin <klyubin@google.com>2015-01-21 17:49:00 -0800
committerAlex Klyubin <klyubin@google.com>2015-01-23 08:52:57 -0800
commitb8211a7b902b559da234264f5fa1fcf09677f54b (patch)
treed25484687ded4f43bb673287121070f3c038943a /luni/src/main/java/javax/crypto
parent194940746a618d361b26838e2c6ff04c358adff7 (diff)
downloadlibcore-b8211a7b902b559da234264f5fa1fcf09677f54b.zip
libcore-b8211a7b902b559da234264f5fa1fcf09677f54b.tar.gz
libcore-b8211a7b902b559da234264f5fa1fcf09677f54b.tar.bz2
Make Cipher.update return null for empty input.
Cipher.update(byte[], int, int inputLen) is supposed to return null when inputLen is zero. This CL makes it so. Prior to this CL, this method returned an empty byte array. Bug: 19100173 Change-Id: I5698f11f76a17dd8fc2509be5d8ec9369a888eaf
Diffstat (limited to 'luni/src/main/java/javax/crypto')
-rw-r--r--luni/src/main/java/javax/crypto/Cipher.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/luni/src/main/java/javax/crypto/Cipher.java b/luni/src/main/java/javax/crypto/Cipher.java
index 2e3b341..889ac9f 100644
--- a/luni/src/main/java/javax/crypto/Cipher.java
+++ b/luni/src/main/java/javax/crypto/Cipher.java
@@ -1005,8 +1005,7 @@ public class Cipher {
* the offset in the input to start.
* @param inputLen
* the length of the input to transform.
- * @return the transformed bytes in a new buffer, or {@code null} if the
- * input has zero length.
+ * @return the transformed bytes in a new buffer, or {@code null} if {@code inputLen} is zero.
* @throws IllegalStateException
* if this cipher instance is not initialized for encryption or
* decryption.
@@ -1023,7 +1022,7 @@ public class Cipher {
throw new IllegalArgumentException("input == null");
}
checkInputOffsetAndCount(input.length, inputOffset, inputLen);
- if (input.length == 0) {
+ if (inputLen == 0) {
return null;
}
return getSpi().engineUpdate(input, inputOffset, inputLen);