Skip to content

Conversation

@laurentschoelens
Copy link
Contributor

Fixes #325

Regression from #309 and #282

If a character is not in base64 decoding map, it's ignored into the decoding process
newlines and spaces / tabulations or just ignored.

Restore previous base64 decoding function and protect code from throwing ArrayIndexOutOfBoundsException

@antoniosanct
Copy link
Contributor

This change has made the code intolerant of whitespace, which caused us some issues recently after upgrading.

Base64 encoding ignores whitespace so normally anything working with it is tolerant of it.

It might be good to modify this to allow for the case you are supporting without making whitespace something that isn't supported.

We fixed our issues by adding a whitespace filter.

I'm assuming that others will also be impacted by this.

Just an FYI, if this is intentional and you feel that enforcing whitespace is the right thing to do then that's fine. However from the commit message I assume you may not have realized the impact.

@laurentschoelens @lukasj Please, could your merge this PR ASAP?

Regards,
Antonio.

@laurentschoelens
Copy link
Contributor Author

This need to be merged by one of the repo owner, I've only provided the actual fix in that PR @antoniosanct

I'll try to reach someone if I can

* A benchmark showed that taking {@link String} is faster, presumably
* because JIT can inline a lot of string access (with data of 1K chars, it was twice as fast)
*/
public static byte[] _parseBase64Binary(String text) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to not use the JDK-built in Base64 class? (avail since: 1.8)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should take a look but maybe base64 in jdk is more strict than here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DatatypeConverterImpl._parseBase64Binary(text) fails if text contains whitespace

3 participants