question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow "optional-padding" for `Base64Variant`

See original GitHub issue

(note: follow-up from https://github.com/FasterXML/jackson-databind/issues/2183)

Currently Base64Variant instances either require use of specific padding character (and use it for output) or disable use of padding completely (neither written nor accepted). But it seems that sometimes a more lenient variant would make sense: one that

  1. Does write padding (with specific character) and
  2. Accepts specific padding but does not require it (i.e. ok to omit)

It seems best to add a “mutant factory” method in Base64Variant instance (something like withLenientPadding(boolean) maybe?). Whether additional entries should be added Base64Variants is an open question. We’ll have to figure out what to do wrt existing “usePadding()” compared to new option; API may be cumbersome if we have 2 booleans but just 3 legal combinations.

Note that we may also change API for configuration for Jackson 3.x, later on.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
cowtowncodercommented, Oct 13, 2020

I would think chaining would usually be used like

Base64Variant base64Variant = Base64Variants.MIME.withPaddingForbidden();

I specifically do not want to make Base64Variants mutable as they are immutable as that just opens up many new ways to get things to fail in interesting ways. 😃

0reactions
cowtowncodercommented, Oct 15, 2020

@pavan-kalyan Addition of new constructors would be needed yes, and expected. Existing constructors should be left for compatibility reasons, although may be deprecated if that makes sense (for eventual removal from 3.0).

I do not remember exact details of current set up but I think it is rigidly keeping settings so that if padding is used on writing, it must be found on reading too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uses of Class com.fasterxml.jackson.core.Base64Variant
Fields in com.fasterxml.jackson.core declared as Base64Variant ... readBinaryValue(OutputStream) but allows explicitly specifying base64 variant to use.
Read more >
Security update for jackson-databind, jackson-dataformats ...
Type' should accept array of names + Jackson version alignment with Gradle 6 ... int)' + Allow "optional-padding" for 'Base64Variant' + More ...
Read more >
Which variant of base64 encoding is created by Buffer.toString ...
Short answer: The Base64 variant of Buffer.toString('base64') is: Base64 standard RFC 4648 §4. Longer answer (why and how):.
Read more >
Program Listing for carb/extras/Base64.h — carbonite 136.0 ...
... Base64() : Base64(Variant::eDefault) { } Base64(Variant variant) { switch ... This will allow extra or optional padding bytes to // be ignored...
Read more >
SUSE alert SUSE-SU-2022:1678-1 (jackson-databind ...
Type' should accept array of names + Jackson version alignment with Gradle 6 ... int)' + Allow "optional-padding" for 'Base64Variant' + More ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found