You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2023/05/04 01:56:54 UTC

[eventmesh] branch master updated: [ISSUE #3015] Found reliance on default encoding: String.getBytes() [GrpcClientHandler] (#3779)

This is an automated email from the ASF dual-hosted git repository.

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 5bfe07d55 [ISSUE #3015] Found reliance on default encoding: String.getBytes() [GrpcClientHandler] (#3779)
5bfe07d55 is described below

commit 5bfe07d55b784386206a21b081104f3b0e8e0a5d
Author: Piyush <11...@users.noreply.github.com>
AuthorDate: Thu May 4 07:26:48 2023 +0530

    [ISSUE #3015] Found reliance on default encoding: String.getBytes() [GrpcClientHandler] (#3779)
    
    * Updated GrpcClientHandler.java #3015
    
    * Update GrpcClientHandler.java
    
    * Update GrpcClientHandler.java
    
    ---------
    
    Co-authored-by: mike_xwm <mi...@126.com>
---
 .../eventmesh/runtime/admin/handler/GrpcClientHandler.java       | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/GrpcClientHandler.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/GrpcClientHandler.java
index 2af046d4d..5c59ae1dc 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/GrpcClientHandler.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/GrpcClientHandler.java
@@ -17,6 +17,7 @@
 
 package org.apache.eventmesh.runtime.admin.handler;
 
+import org.apache.eventmesh.common.Constants;
 import org.apache.eventmesh.common.utils.JsonUtils;
 import org.apache.eventmesh.runtime.admin.controller.HttpHandlerManager;
 import org.apache.eventmesh.runtime.admin.request.DeleteGrpcClientRequest;
@@ -148,8 +149,8 @@ public class GrpcClientHandler extends AbstractHttpHandler {
             });
 
             String result = JsonUtils.toJSONString(getClientResponseList);
-            httpExchange.sendResponseHeaders(200, result.getBytes().length);
-            out.write(result.getBytes());
+            httpExchange.sendResponseHeaders(200, result.getBytes(Constants.DEFAULT_CHARSET).length);
+            out.write(result.getBytes(Constants.DEFAULT_CHARSET));
         } catch (Exception e) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
@@ -159,8 +160,8 @@ public class GrpcClientHandler extends AbstractHttpHandler {
 
             Error error = new Error(e.toString(), stackTrace);
             String result = JsonUtils.toJSONString(error);
-            httpExchange.sendResponseHeaders(500, result.getBytes().length);
-            out.write(result.getBytes());
+            httpExchange.sendResponseHeaders(500, result.getBytes(Constants.DEFAULT_CHARSET).length);
+            out.write(result.getBytes(Constants.DEFAULT_CHARSET));
         } finally {
             if (out != null) {
                 try {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org