Skip to content

Conversation

@alexmoore
Copy link
Contributor

@alexmoore alexmoore commented Jul 22, 2016

Fixes #549 (CLIENTS-602).

Currently the Java client will attach a RiakObject's charset setting to the content-type:

RiakObject ro = new RiakObject();
ro.setContentType("application/json");
ro.setCharset("UTF-16");

ro.getContentType(); // -> "application/json;charset=UTF-16"

While not 100% wrong, we should separate them.

If you save the above object to Riak, and fetch it via the HTTP interface you'll get: "application/json;charset=UTF-16; charset=UTF-16" since we duplicate the charset to the proper charset buffer, but don't remove it from the content-type.

This PR introduces a proper charset member on the RiakObject class. We will no longer attach it to the content-type, and we don't care if they set one there or not, as to not break existing code.

If this new charset member is not set it will attempt to see if there is one present in the content-type for the getCharset() and hasCharset() methods, for backwards compatibility.

Thanks to @gfbett for reporting the issue.

@christophermancini
Copy link

👍 Code looks good and tests pass.

@alexmoore alexmoore merged commit 24bddd6 into develop Jul 22, 2016
@alexmoore alexmoore deleted the 549-duplicate-charset branch July 22, 2016 18:36
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.

5 participants