Let's consider the following codebase:
val str = "contextId"
println(org.apache.commons.codec.binary.Base64.isBase64(str))
String(java.util.Base64.getDecoder().decode(str))
It prints:
true
Exception in thread "main" java.lang.IllegalArgumentException: Last unit does not have enough valid bits
at java.base/java.util.Base64$Decoder.decode0(Base64.java:867)
at java.base/java.util.Base64$Decoder.decode(Base64.java:566)
at java.base/java.util.Base64$Decoder.decode(Base64.java:589)
...
It looks contradictory for me.
Could you please explain this behaviour?