AmadeusITGroup / sonar-stash

Stash (BitBucket) plugin, a pull-request decorator which allows to integrate SonarQube violations directly into your pull-request
MIT License
165 stars 82 forks source link

[FIX] Added charset UTF-8 in requestBuilder #186

Closed svenmalvik closed 6 years ago

svenmalvik commented 6 years ago

We had an issue with sending a comment with special characters like the norwegian letter "ø" to stash. I added charset UTF-8 in requestBuilder. Insight from Wikipedia about Json: JSON exchange in an open ecosystem must be encoded in UTF-8. (https://en.wikipedia.org/wiki/JSON)

t-8ch commented 6 years ago

Hi @svenmalvik, thanks for this! Two points:

svenmalvik commented 6 years ago

I have squashed all commits into one. I got an exception saying that it cannot post 0xf8 (norwegian letter ø) to stash. An upgrade of json_simple to 3.0.2 didn't fix the problem.

12:22:44 [INFO] {"errors":[{"context":null,"message":"Invalid UTF-8 start byte 0xf8\n at [Source: com.atlassian.stash.internal.web.util.web.CountingServletInputStream@41be8846; line: 1, column: 788]","exceptionName":"org.codehaus.jackson.JsonParseException"}]} 12:22:44 [ERROR] Unable to push SonarQube analysis overview to Stash 12:22:44 org.sonar.plugins.stash.exceptions.StashClientException: Unable to post a comment to vl-foreldrepenger #587. Received 400: org.codehaus.jackson.JsonParseException: Invalid UTF-8 start byte 0xf8 12:22:44 at [Source: com.atlassian.stash.internal.web.util.web.CountingServletInputStream@41be8846; line: 1, column: 788] 12:22:44 at org.sonar.plugins.stash.client.StashClient.validateResponse(StashClient.java:383)

svenmalvik commented 6 years ago

Done

t-8ch commented 6 years ago

Thanks!