天天看點

關于base64使用報錯

SpringBoot從2.1.13更新到2.3.11時候,發現commons-codec 變成了1.14 ,使用base64出現下列異常提示。

at org.apache.commons.codec.binary.Base64.validateCharacter(Base64.java:798)java.lang.IllegalArgumentException: Last encoded character (before the paddings if any) is a valid base 64 alphabet but not a possible value

at org.apache.commons.codec.binary.Base64.decode(Base64.java:477)

at org.apache.commons.codec.binary.BaseNCodec.decode(BaseNCodec.java:411)

at org.apache.commons.codec.binary.BaseNCodec.decode(BaseNCodec.java:395)

降低版本到1.12以下可以解決該問題,或者commons-codec版本更新到1.15,最新的源碼已經處理了該問題。我這邊采用的是版本更新到1.15