From af79cf070e603f445566b8057305ad0b29f20b12 Mon Sep 17 00:00:00 2001 From: Pavan Kalyan Damalapati Date: Sat, 17 Oct 2020 18:51:31 +0530 Subject: [PATCH 1/7] improvement: allowing more granular control of reading behaviour for base64 --- .../fasterxml/jackson/core/Base64Variant.java | 56 +++++++++++++++++-- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java index 6ef399f9fa..f4d52d76ba 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java @@ -87,6 +87,11 @@ public final class Base64Variant */ private final transient boolean _usesPadding; + /** + * Whether padding characters should be required or not while decoding + */ + private final transient PaddingReadBehaviour _paddingReadBehaviour; + /** * Character used for padding, if any ({@link #PADDING_CHAR_NONE} if not). */ @@ -136,6 +141,12 @@ public Base64Variant(String name, String base64Alphabet, boolean usesPadding, ch if (usesPadding) { _asciiToBase64[(int) paddingChar] = BASE64_VALUE_PADDING; } + + if (usesPadding) { + this._paddingReadBehaviour = PaddingReadBehaviour.PADDING_REQUIRED; + } else { + this._paddingReadBehaviour = PaddingReadBehaviour.PADDING_FORBIDDEN; + } } /** @@ -154,6 +165,11 @@ public Base64Variant(Base64Variant base, String name, int maxLineLength) * line length) differ */ public Base64Variant(Base64Variant base, String name, boolean usesPadding, char paddingChar, int maxLineLength) + { + this(base, name, usesPadding, paddingChar, base._paddingReadBehaviour, maxLineLength); + } + + private Base64Variant(Base64Variant base, String name, boolean usesPadding, char paddingChar, PaddingReadBehaviour paddingReadBehaviour, int maxLineLength) { _name = name; byte[] srcB = base._base64ToAsciiB; @@ -166,6 +182,35 @@ public Base64Variant(Base64Variant base, String name, boolean usesPadding, char _usesPadding = usesPadding; _paddingChar = paddingChar; _maxLineLength = maxLineLength; + this._paddingReadBehaviour = paddingReadBehaviour; + } + + private Base64Variant(Base64Variant base, PaddingReadBehaviour paddingReadBehaviour) { + this(base, base._name, base._usesPadding, base._paddingChar, paddingReadBehaviour, base._maxLineLength); + } + + public Base64Variant withPaddingAllowed() { + return new Base64Variant(this, PaddingReadBehaviour.PADDING_ALLOWED); + } + + public Base64Variant withPaddingRequired() { + return new Base64Variant(this, PaddingReadBehaviour.PADDING_REQUIRED); + } + + public Base64Variant withPaddingForbidden() { + return new Base64Variant(this, PaddingReadBehaviour.PADDING_FORBIDDEN); + } + + public Base64Variant withWritePadding(boolean writePadding) { + return new Base64Variant(this, this._name, writePadding, this._paddingChar, this._maxLineLength); + + } + + private enum PaddingReadBehaviour { + PADDING_FORBIDDEN, + PADDING_REQUIRED, + PADDING_ALLOWED + ; } /* @@ -193,6 +238,7 @@ protected Object readResolve() { public boolean usesPadding() { return _usesPadding; } public boolean usesPaddingChar(char c) { return c == _paddingChar; } public boolean usesPaddingChar(int ch) { return ch == (int) _paddingChar; } + public PaddingReadBehaviour paddingReadBehaviour() { return _paddingReadBehaviour; } public char getPaddingChar() { return _paddingChar; } public byte getPaddingByte() { return (byte)_paddingChar; } @@ -275,7 +321,7 @@ public int encodeBase64Partial(int bits, int outputBytes, char[] buffer, int out { buffer[outPtr++] = _base64ToAsciiC[(bits >> 18) & 0x3F]; buffer[outPtr++] = _base64ToAsciiC[(bits >> 12) & 0x3F]; - if (_usesPadding) { + if (usesPadding()) { buffer[outPtr++] = (outputBytes == 2) ? _base64ToAsciiC[(bits >> 6) & 0x3F] : _paddingChar; buffer[outPtr++] = _paddingChar; @@ -291,7 +337,7 @@ public void encodeBase64Partial(StringBuilder sb, int bits, int outputBytes) { sb.append(_base64ToAsciiC[(bits >> 18) & 0x3F]); sb.append(_base64ToAsciiC[(bits >> 12) & 0x3F]); - if (_usesPadding) { + if (usesPadding()) { sb.append((outputBytes == 2) ? _base64ToAsciiC[(bits >> 6) & 0x3F] : _paddingChar); sb.append(_paddingChar); @@ -333,7 +379,7 @@ public int encodeBase64Partial(int bits, int outputBytes, byte[] buffer, int out { buffer[outPtr++] = _base64ToAsciiB[(bits >> 18) & 0x3F]; buffer[outPtr++] = _base64ToAsciiB[(bits >> 12) & 0x3F]; - if (_usesPadding) { + if (usesPadding()) { byte pb = (byte) _paddingChar; buffer[outPtr++] = (outputBytes == 2) ? _base64ToAsciiB[(bits >> 6) & 0x3F] : pb; @@ -529,8 +575,8 @@ public void decode(String str, ByteArrayBuilder builder) throws IllegalArgumentE decodedData = (decodedData << 6) | bits; // third base64 char; can be padding, but not ws if (ptr >= len) { - // but as per [JACKSON-631] can be end-of-input, iff not using padding - if (!usesPadding()) { + // but as per [JACKSON-631] can be end-of-input, iff padding is not required + if (!paddingReadBehaviour().equals(PaddingReadBehaviour.PADDING_REQUIRED)) { decodedData >>= 4; builder.append(decodedData); break; From fb36d651634eb1421cca91014fc50a930170e97f Mon Sep 17 00:00:00 2001 From: Pavan Kalyan Damalapati Date: Sun, 18 Oct 2020 09:13:01 +0530 Subject: [PATCH 2/7] docs: adding @since 2.12 to java docs for non-private methods --- .../com/fasterxml/jackson/core/Base64Variant.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java index f4d52d76ba..c6f3c02db8 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java @@ -90,7 +90,7 @@ public final class Base64Variant /** * Whether padding characters should be required or not while decoding */ - private final transient PaddingReadBehaviour _paddingReadBehaviour; + private final PaddingReadBehaviour _paddingReadBehaviour; /** * Character used for padding, if any ({@link #PADDING_CHAR_NONE} if not). @@ -189,18 +189,30 @@ private Base64Variant(Base64Variant base, PaddingReadBehaviour paddingReadBehavi this(base, base._name, base._usesPadding, base._paddingChar, paddingReadBehaviour, base._maxLineLength); } + /** + * @since 2.12 + */ public Base64Variant withPaddingAllowed() { return new Base64Variant(this, PaddingReadBehaviour.PADDING_ALLOWED); } + /** + * @since 2.12 + */ public Base64Variant withPaddingRequired() { return new Base64Variant(this, PaddingReadBehaviour.PADDING_REQUIRED); } + /** + * @since 2.12 + */ public Base64Variant withPaddingForbidden() { return new Base64Variant(this, PaddingReadBehaviour.PADDING_FORBIDDEN); } + /** + * @since 2.12 + */ public Base64Variant withWritePadding(boolean writePadding) { return new Base64Variant(this, this._name, writePadding, this._paddingChar, this._maxLineLength); From 5c60aa604faa5bab03f0974d00aae3650125e85c Mon Sep 17 00:00:00 2001 From: Pavan Kalyan Damalapati Date: Sun, 18 Oct 2020 14:30:16 +0530 Subject: [PATCH 3/7] tests: added tests for read behaviour and a few fixes --- .../fasterxml/jackson/core/Base64Variant.java | 27 ++++++- .../jackson/core/base64/Base64CodecTest.java | 70 +++++++++++++++++-- 2 files changed, 90 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java index c6f3c02db8..704007f2cb 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java @@ -603,6 +603,9 @@ public void decode(String str, ByteArrayBuilder builder) throws IllegalArgumentE if (bits != Base64Variant.BASE64_VALUE_PADDING) { _reportInvalidBase64(ch, 2, null); } + if (paddingReadBehaviour().equals(PaddingReadBehaviour.PADDING_FORBIDDEN)) { + _reportBase64UnexpectedPadding(); + } // Ok, must get padding if (ptr >= len) { _reportBase64EOF(); @@ -620,8 +623,8 @@ public void decode(String str, ByteArrayBuilder builder) throws IllegalArgumentE decodedData = (decodedData << 6) | bits; // fourth and last base64 char; can be padding, but not ws if (ptr >= len) { - // but as per [JACKSON-631] can be end-of-input, iff not using padding - if (!usesPadding()) { + // but as per [JACKSON-631] can be end-of-input, iff padding on read is not required + if (!paddingReadBehaviour().equals(PaddingReadBehaviour.PADDING_REQUIRED)) { decodedData >>= 2; builder.appendTwoBytes(decodedData); break; @@ -634,6 +637,9 @@ public void decode(String str, ByteArrayBuilder builder) throws IllegalArgumentE if (bits != Base64Variant.BASE64_VALUE_PADDING) { _reportInvalidBase64(ch, 3, null); } + if (paddingReadBehaviour().equals(PaddingReadBehaviour.PADDING_FORBIDDEN)) { + _reportBase64UnexpectedPadding(); + } decodedData >>= 2; builder.appendTwoBytes(decodedData); } else { @@ -698,6 +704,21 @@ protected void _reportBase64EOF() throws IllegalArgumentException { throw new IllegalArgumentException(missingPaddingMessage()); } + protected void _reportBase64UnexpectedPadding() throws IllegalArgumentException { + throw new IllegalArgumentException(unexpectedPaddingMessage()); + } + + /** + * Helper method that will construct a message to use in exceptions for cases where input ends + * prematurely in place where padding would be expected. + * + * @since 2.12 + */ + public String unexpectedPaddingMessage() { + return String.format("Unexpected end of base64-encoded String: derived base64 variant '%s' expects no padding at the end while decoding. This Base64Variant might have been incorrectly configured", + getName()); + } + /** * Helper method that will construct a message to use in exceptions for cases where input ends * prematurely in place where padding would be expected. @@ -705,7 +726,7 @@ protected void _reportBase64EOF() throws IllegalArgumentException { * @since 2.10 */ public String missingPaddingMessage() { - return String.format("Unexpected end of base64-encoded String: base64 variant '%s' expects padding (one or more '%c' characters) at the end", + return String.format("Unexpected end of base64-encoded String: derived base64 variant '%s' expects padding (one or more '%c' characters) at the end. This Base64Variant might have been incorrectly configured", getName(), getPaddingChar()); } 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 66906ebadf..d02e0c4095 100644 --- a/src/test/java/com/fasterxml/jackson/core/base64/Base64CodecTest.java +++ b/src/test/java/com/fasterxml/jackson/core/base64/Base64CodecTest.java @@ -52,7 +52,7 @@ public void testCharEncoding() throws Exception assertEquals(Base64Variant.BASE64_VALUE_INVALID, std.decodeBase64Byte((byte) '?')); assertEquals(Base64Variant.BASE64_VALUE_INVALID, std.decodeBase64Byte((byte) 0xA0)); - + assertEquals(0, std.decodeBase64Char('A')); assertEquals(1, std.decodeBase64Char((int) 'B')); assertEquals(2, std.decodeBase64Char((byte)'C')); @@ -60,7 +60,7 @@ public void testCharEncoding() throws Exception assertEquals(0, std.decodeBase64Byte((byte) 'A')); assertEquals(1, std.decodeBase64Byte((byte) 'B')); assertEquals(2, std.decodeBase64Byte((byte)'C')); - + assertEquals('/', std.encodeBase64BitsAsChar(63)); assertEquals((byte) 'b', std.encodeBase64BitsAsByte(27)); @@ -82,7 +82,7 @@ public void testConvenienceMethods() throws Exception byte[] input = new byte[] { 1, 2, 34, 127, -1 }; String encoded = std.encode(input, false); - byte[] decoded = std.decode(encoded); + byte[] decoded = std.decode(encoded); Assert.assertArrayEquals(input, decoded); assertEquals(quote(encoded), std.encode(input, true)); @@ -115,7 +115,7 @@ public void testConvenienceMethodWithLFs() throws Exception } sb.append("AQ=="); final String exp = sb.toString(); - + // first, JSON standard assertEquals(exp.replace("##", "\\n"), std.encode(data, false)); @@ -148,4 +148,66 @@ public void testErrors() throws Exception verifyException(iae, "Illegal character"); } } + + public void testPaddingReadBehaviour() throws Exception { + + for (Base64Variant variant: Arrays.asList(Base64Variants.MIME, Base64Variants.MIME_NO_LINEFEEDS, Base64Variants.PEM)) { + + final String BASE64_HELLO = "aGVsbG8="; + try { + variant.withPaddingForbidden().decode(BASE64_HELLO); + fail("Should not pass"); + } catch (IllegalArgumentException iae) { + verifyException(iae, "no padding"); + } + + variant.withPaddingAllowed().decode(BASE64_HELLO); + variant.withPaddingRequired().decode(BASE64_HELLO); + + final String BASE64_HELLO_WITHOUT_PADDING = "aGVsbG8"; + try { + variant.withPaddingRequired().decode(BASE64_HELLO_WITHOUT_PADDING); + fail("Should not pass"); + } catch (IllegalArgumentException iae) { + verifyException(iae, "expects padding"); + } + variant.withPaddingAllowed().decode(BASE64_HELLO_WITHOUT_PADDING); + variant.withPaddingForbidden().decode(BASE64_HELLO_WITHOUT_PADDING); + } + + //testing for MODIFIED_FOR_URL + + final String BASE64_HELLO = "aGVsbG8="; + try { + Base64Variants.MODIFIED_FOR_URL.withPaddingForbidden().decode(BASE64_HELLO); + fail("Should not pass"); + } catch (IllegalArgumentException iae) { + verifyException(iae, "illegal character"); + } + + try { + Base64Variants.MODIFIED_FOR_URL.withPaddingAllowed().decode(BASE64_HELLO); + fail("Should not pass"); + } catch (IllegalArgumentException iae) { + verifyException(iae, "illegal character"); + } + + try { + Base64Variants.MODIFIED_FOR_URL.withPaddingRequired().decode(BASE64_HELLO); + fail("Should not pass"); + } catch (IllegalArgumentException iae) { + verifyException(iae, "illegal character"); + } + + final String BASE64_HELLO_WITHOUT_PADDING = "aGVsbG8"; + try { + Base64Variants.MODIFIED_FOR_URL.withPaddingRequired().decode(BASE64_HELLO_WITHOUT_PADDING); + fail("Should not pass"); + } catch (IllegalArgumentException iae) { + verifyException(iae, "expects padding"); + } + Base64Variants.MODIFIED_FOR_URL.withPaddingAllowed().decode(BASE64_HELLO_WITHOUT_PADDING); + Base64Variants.MODIFIED_FOR_URL.withPaddingForbidden().decode(BASE64_HELLO_WITHOUT_PADDING); + + } } From 9cc8d93b9dc154aba70b372687128a85f259f0c7 Mon Sep 17 00:00:00 2001 From: Pavan Kalyan Damalapati Date: Sun, 18 Oct 2020 14:49:22 +0530 Subject: [PATCH 4/7] tests: fixing error messages and comments for test --- src/main/java/com/fasterxml/jackson/core/Base64Variant.java | 6 +++--- .../com/fasterxml/jackson/core/base64/Base64CodecTest.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java index 704007f2cb..af3886ee55 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java @@ -710,12 +710,12 @@ protected void _reportBase64UnexpectedPadding() throws IllegalArgumentException /** * Helper method that will construct a message to use in exceptions for cases where input ends - * prematurely in place where padding would be expected. + * prematurely in place where padding is not expected. * * @since 2.12 */ public String unexpectedPaddingMessage() { - return String.format("Unexpected end of base64-encoded String: derived base64 variant '%s' expects no padding at the end while decoding. This Base64Variant might have been incorrectly configured", + return String.format("Unexpected end of base64-encoded String: base64 variant '%s' expects no padding at the end while decoding. This Base64Variant might have been incorrectly configured", getName()); } @@ -726,7 +726,7 @@ public String unexpectedPaddingMessage() { * @since 2.10 */ public String missingPaddingMessage() { - return String.format("Unexpected end of base64-encoded String: derived base64 variant '%s' expects padding (one or more '%c' characters) at the end. This Base64Variant might have been incorrectly configured", + return String.format("Unexpected end of base64-encoded String: base64 variant '%s' expects padding (one or more '%c' characters) at the end. This Base64Variant might have been incorrectly configured", getName(), getPaddingChar()); } 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 d02e0c4095..3917eef429 100644 --- a/src/test/java/com/fasterxml/jackson/core/base64/Base64CodecTest.java +++ b/src/test/java/com/fasterxml/jackson/core/base64/Base64CodecTest.java @@ -206,6 +206,7 @@ public void testPaddingReadBehaviour() throws Exception { } catch (IllegalArgumentException iae) { verifyException(iae, "expects padding"); } + Base64Variants.MODIFIED_FOR_URL.withPaddingAllowed().decode(BASE64_HELLO_WITHOUT_PADDING); Base64Variants.MODIFIED_FOR_URL.withPaddingForbidden().decode(BASE64_HELLO_WITHOUT_PADDING); From 74ea8d3327a0d3098c7790b787bb52e9728a49f5 Mon Sep 17 00:00:00 2001 From: Pavan Kalyan Damalapati Date: Sun, 25 Oct 2020 01:22:22 +0530 Subject: [PATCH 5/7] docs: added more relevant java docs --- .../com/fasterxml/jackson/core/Base64Variant.java | 11 ++++++++++- .../com/fasterxml/jackson/core/Base64Variants.java | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java index af3886ee55..0c3daceca3 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variant.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variant.java @@ -190,6 +190,7 @@ private Base64Variant(Base64Variant base, PaddingReadBehaviour paddingReadBehavi } /** + * @return Base64Variant which does not require padding on read * @since 2.12 */ public Base64Variant withPaddingAllowed() { @@ -197,6 +198,7 @@ public Base64Variant withPaddingAllowed() { } /** + * @return Base64Variant which requires padding on read * @since 2.12 */ public Base64Variant withPaddingRequired() { @@ -204,6 +206,7 @@ public Base64Variant withPaddingRequired() { } /** + * @return Base64Variant which does not accept padding on read * @since 2.12 */ public Base64Variant withPaddingForbidden() { @@ -211,6 +214,8 @@ public Base64Variant withPaddingForbidden() { } /** + * @param writePadding Determines if padding is output on write + * @return Base64Variant which writes padding or not depending on writePadding * @since 2.12 */ public Base64Variant withWritePadding(boolean writePadding) { @@ -218,7 +223,11 @@ public Base64Variant withWritePadding(boolean writePadding) { } - private enum PaddingReadBehaviour { + /** + * Defines how the Base64Variant deals with Padding while reading + * @since 2.12 + */ + public enum PaddingReadBehaviour { PADDING_FORBIDDEN, PADDING_REQUIRED, PADDING_ALLOWED diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variants.java b/src/main/java/com/fasterxml/jackson/core/Base64Variants.java index 0112d2c07f..7c5d7cf5c0 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variants.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variants.java @@ -12,7 +12,10 @@ *
  • {@link #PEM} *
  • {@link #MODIFIED_FOR_URL} * - * + * + * If a Base64Variant with default configuration outputs padding it also expects it on reading. + * If it does not output padding it will not accept padding on read. + * * @author Tatu Saloranta */ public final class Base64Variants From f330dd60785f6a402a45c460c75711838be6619e Mon Sep 17 00:00:00 2001 From: Pavan Kalyan Damalapati Date: Sun, 25 Oct 2020 03:43:11 +0530 Subject: [PATCH 6/7] docs: adding padding info to each variant and linking method --- src/main/java/com/fasterxml/jackson/core/Base64Variants.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variants.java b/src/main/java/com/fasterxml/jackson/core/Base64Variants.java index 7c5d7cf5c0..ea9170d0b2 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variants.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variants.java @@ -31,6 +31,7 @@ public final class Base64Variants * Note that although this can be thought of as the standard variant, * it is not the default for Jackson: no-linefeeds alternative * is because of JSON requirement of escaping all linefeeds. + * writes padding on output; does not accept padding when reading (may change latter with a call to {@link Base64Variant#withWritePadding(boolean)}]) */ public final static Base64Variant MIME; static { @@ -42,6 +43,7 @@ public final class Base64Variants * use linefeeds (max line length set to infinite). Useful when linefeeds * wouldn't work well (possibly in attributes), or for minor space savings * (save 1 linefeed per 76 data chars, ie. ~1.4% savings). + * writes padding on output; does not accept padding when reading (may change latter with a call to {@link Base64Variant#withWritePadding(boolean)}]) */ public final static Base64Variant MIME_NO_LINEFEEDS; static { @@ -51,6 +53,7 @@ public final class Base64Variants /** * This variant is the one that predates {@link #MIME}: it is otherwise * identical, except that it mandates shorter line length. + * writes padding on output; does not accept padding when reading (may change latter with a call to {@link Base64Variant#withWritePadding(boolean)}]) */ public final static Base64Variant PEM = new Base64Variant(MIME, "PEM", true, '=', 64); @@ -64,6 +67,7 @@ public final class Base64Variants * line length set to infinite). And finally, two characters (plus and * slash) that would need quoting in URLs are replaced with more * optimal alternatives (hyphen and underscore, respectively). + * writes padding on output; does not accept padding when reading (may change latter with a call to {@link Base64Variant#withWritePadding(boolean)}]) */ public final static Base64Variant MODIFIED_FOR_URL; static { From 26f0807ff806a3cc820d1cbf78f5c31c6b8a80ce Mon Sep 17 00:00:00 2001 From: Pavan Kalyan Damalapati Date: Sun, 25 Oct 2020 12:38:15 +0530 Subject: [PATCH 7/7] docs: typo --- .../java/com/fasterxml/jackson/core/Base64Variants.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/core/Base64Variants.java b/src/main/java/com/fasterxml/jackson/core/Base64Variants.java index ea9170d0b2..0b844daa87 100644 --- a/src/main/java/com/fasterxml/jackson/core/Base64Variants.java +++ b/src/main/java/com/fasterxml/jackson/core/Base64Variants.java @@ -31,7 +31,7 @@ public final class Base64Variants * Note that although this can be thought of as the standard variant, * it is not the default for Jackson: no-linefeeds alternative * is because of JSON requirement of escaping all linefeeds. - * writes padding on output; does not accept padding when reading (may change latter with a call to {@link Base64Variant#withWritePadding(boolean)}]) + * writes padding on output; does not accept padding when reading (may change later with a call to {@link Base64Variant#withWritePadding(boolean)}]) */ public final static Base64Variant MIME; static { @@ -43,7 +43,7 @@ public final class Base64Variants * use linefeeds (max line length set to infinite). Useful when linefeeds * wouldn't work well (possibly in attributes), or for minor space savings * (save 1 linefeed per 76 data chars, ie. ~1.4% savings). - * writes padding on output; does not accept padding when reading (may change latter with a call to {@link Base64Variant#withWritePadding(boolean)}]) + * writes padding on output; does not accept padding when reading (may change later with a call to {@link Base64Variant#withWritePadding(boolean)}]) */ public final static Base64Variant MIME_NO_LINEFEEDS; static { @@ -53,7 +53,7 @@ public final class Base64Variants /** * This variant is the one that predates {@link #MIME}: it is otherwise * identical, except that it mandates shorter line length. - * writes padding on output; does not accept padding when reading (may change latter with a call to {@link Base64Variant#withWritePadding(boolean)}]) + * writes padding on output; does not accept padding when reading (may change later with a call to {@link Base64Variant#withWritePadding(boolean)}]) */ public final static Base64Variant PEM = new Base64Variant(MIME, "PEM", true, '=', 64); @@ -67,7 +67,7 @@ public final class Base64Variants * line length set to infinite). And finally, two characters (plus and * slash) that would need quoting in URLs are replaced with more * optimal alternatives (hyphen and underscore, respectively). - * writes padding on output; does not accept padding when reading (may change latter with a call to {@link Base64Variant#withWritePadding(boolean)}]) + * writes padding on output; does not accept padding when reading (may change later with a call to {@link Base64Variant#withWritePadding(boolean)}]) */ public final static Base64Variant MODIFIED_FOR_URL; static {