Duplicate :
|
|
Relates :
|
|
Relates :
|
Mime decoder does not ignore non-Base64 chars that appear after padding ('=') import java.util.Base64; public class CharToIgnoreAtTheEnd { public static void main(String[] args) { Base64.getMimeDecoder().decode("bGVhc3VyZS4=$"); } } The output is Exception in thread "main" java.lang.IllegalArgumentException: Input byte array has wrong 4-byte ending unit at java.util.Base64$Decoder.decode0(Base64.java:1080) at java.util.Base64$Decoder.decode(Base64.java:686) at java.util.Base64$Decoder.decode(Base64.java:709) at CharToIgnoreAtTheEnd.main(CharToIgnoreAtTheEnd.java:6) The following JCK tests will fail due to this issue: api/java_util/Base64/Decoder/index.html#MimeDec_NonBase64CharsIgnored[validInput_ignoredCharAtTheEnd] api/java_util/Base64/Decoder/index.html#MimeDec_NonBase64CharsIgnored[lineSeparatorInTheEnd] api/java_util/Base64/index.html#Samples[phrase_01_decodeToByteArray]
|