You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/06/20 09:52:22 UTC
[GitHub] [calcite-avatica] vlsi commented on a change in pull request #85:
[CALCITE-2704] Avoid use of ISO-8859-1 to parse request in JsonHandler
vlsi commented on a change in pull request #85: [CALCITE-2704] Avoid use of ISO-8859-1 to parse request in JsonHandler
URL: https://github.com/apache/calcite-avatica/pull/85#discussion_r295731758
##########
File path: server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java
##########
@@ -106,14 +106,18 @@ public void handle(String target, Request baseRequest,
// Avoid a new buffer creation for every HTTP request
final UnsynchronizedBuffer buffer = threadLocalBuffer.get();
try (ServletInputStream inputStream = request.getInputStream()) {
- rawRequest = AvaticaUtils.readFully(inputStream, buffer);
+ byte[] bytes = AvaticaUtils.readFullyToBytes(inputStream, buffer);
+ String encoding = request.getCharacterEncoding();
+ if (encoding == null) {
+ encoding = "UTF-8";
Review comment:
@zabetak , @danny0405 , `request.getCharacterEncoding();` returns `String`, and I used `"UTF-8"` here just to simplify the code and have a single `new String(bytes, encoding)` call for both cases (encoding is set, and encoding is not set)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services