Merge branch '2.8'
diff --git a/release-notes/VERSION b/release-notes/VERSION
index bdb3dcb..7d53acf 100644
--- a/release-notes/VERSION
+++ b/release-notes/VERSION
@@ -25,6 +25,12 @@
#325: `DataInput` backed parser should handle `EOFException` at end of doc
(reported by Brad H)
+2.8.6 (not yet released)
+
+#335: Missing exception for invalid last character of base64 string to decode
+ using `Base64Variant.decode()`
+
+2.8.5 (14-Nov-2016)
2.8.4 (14-Oct-2016)
No changes since 2.8.3
diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java
index 84f27dc..5cddea5 100644
--- a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java
+++ b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java
@@ -449,7 +449,7 @@
* assumption is that caller will ensure it is given in proper state, and
* used as appropriate afterwards.
*
- * @since 2.2.3
+ * @since 2.3
*
* @throws IllegalArgumentException if input is not valid base64 encoded data
*/
@@ -458,16 +458,12 @@
int ptr = 0;
int len = str.length();
- main_loop:
while (ptr < len) {
// first, we'll skip preceding white space, if any
char ch;
do {
ch = str.charAt(ptr++);
- if (ptr >= len) {
- break main_loop;
- }
- } while (ch <= INT_SPACE);
+ } while ((ptr < len) && (ch <= INT_SPACE));
int bits = decodeBase64Char(ch);
if (bits < 0) {
_reportInvalidBase64(ch, 0, null);
diff --git a/src/test/java/com/fasterxml/jackson/core/base64/Base64CodecTest.java b/src/test/java/com/fasterxml/jackson/core/base64/Base64CodecTest.java
index 60c148e..6b895ed 100644
--- a/src/test/java/com/fasterxml/jackson/core/base64/Base64CodecTest.java
+++ b/src/test/java/com/fasterxml/jackson/core/base64/Base64CodecTest.java
@@ -95,9 +95,16 @@
} catch (IllegalArgumentException iae) {
verifyException(iae, "length must be exactly");
}
-
try {
Base64Variants.MIME.decode("!@##@%$#%&*^(&)(*");
+ } catch (IllegalArgumentException iae) {
+ verifyException(iae, "Illegal character");
+ }
+
+ // also, for [jackson-core#335]
+ final String BASE64_HELLO = "aGVsbG8=!";
+ try {
+ Base64Variants.MIME.decode(BASE64_HELLO);
fail("Should not pass");
} catch (IllegalArgumentException iae) {
verifyException(iae, "Illegal character");