[ 
https://issues.apache.org/jira/browse/SCB-591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16482232#comment-16482232
 ] 

ASF GitHub Bot commented on SCB-591:
------------------------------------

liubao68 closed pull request #713:  [SCB-591] configcenter need to do encode
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/713
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
 
b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
index aaef866f0..9b78429d5 100644
--- 
a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
+++ 
b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
@@ -23,6 +23,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -329,8 +330,15 @@ private void sendHeartbeat(WebSocket ws) {
 
     public void refreshConfig(String configcenter, boolean wait) {
       CountDownLatch latch = new CountDownLatch(1);
+      String encodeServiceName = "";
+      try {
+        encodeServiceName = 
URLEncoder.encode(StringUtils.deleteWhitespace(serviceName), 
StandardCharsets.UTF_8.name());
+      } catch (UnsupportedEncodingException e) {
+        LOGGER.error("encode failed. Error message: {}", e.getMessage());
+        encodeServiceName = StringUtils.deleteWhitespace(serviceName);
+      }
+      String path = URIConst.ITEMS + "?dimensionsInfo=" + encodeServiceName;
       clientMgr.findThreadBindClientPool().runOnContext(client -> {
-        String path = URIConst.ITEMS + "?dimensionsInfo=" + 
StringUtils.deleteWhitespace(serviceName);
         IpPort ipPort = NetUtils.parseIpPortFromURI(configcenter);
         HttpClientRequest request = client.get(ipPort.getPort(), 
ipPort.getHostOrIp(), path, rsp -> {
           if (rsp.statusCode() == HttpResponseStatus.OK.code()) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> configcenter need to do encode
> ------------------------------
>
>                 Key: SCB-591
>                 URL: https://issues.apache.org/jira/browse/SCB-591
>             Project: Apache ServiceComb
>          Issue Type: Bug
>          Components: Java-Chassis
>            Reporter: WeiChao
>            Assignee: WeiChao
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to