With 3.11.x the behavior for Base64.decode changed, previously it would
seamlessly handle both urlSafe and standard modes.
As still documented in the constructor Base64(int lineLength, byte[]
lineSeparator, final boolean urlSafe)
"@param urlSafe Instead of emitting '+' and '/' we emit '-' and '_'
respectively. urlSafe is only applied to encode operations. Decoding seamlessly
handles both modes."
The following now throws IllegalArgumentException: Illegal base64 character 2d
boolean urlSafe = false;
String encoded = "o6wBF2p1dwkzJbXY+vUaAg==";
final byte[] bytesToEncode = new Base64(0, new byte[] {},
false).decode(encoded);
urlSafe = true;
String encodedUrlSafe = new Base64(0, new byte[] {},
true).encodeToString(bytesToEncode);
final byte[] decoded = new Base64(0, new byte[] {},
false).decode(encodedUrlSafe);
Revisions before this commit still have the expected behavior:
https://github.com/apache/commons-net/commit/deb24bf22b1f75e4dc1bc981f2bcd37f5c407ceb
Although Base64 is deprecated, its behavior should not change.
Thanks,
Alexander
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]