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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7cef16bba6 fix consul sync problem (#5545) (#5546)
7cef16bba6 is described below

commit 7cef16bba66e903c4bdd6f9d48c035b436880b4f
Author: wyfvsfy <[email protected]>
AuthorDate: Sat May 18 10:52:07 2024 +0800

    fix consul sync problem (#5545) (#5546)
    
    Co-authored-by: 王一飞 <[email protected]>
    Co-authored-by: xiaoyu <[email protected]>
---
 .../listener/AbstractPathDataChangedListener.java  | 26 ++++++++--------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git 
a/shenyu-admin-listener/shenyu-admin-listener-api/src/main/java/org/apache/shenyu/admin/listener/AbstractPathDataChangedListener.java
 
b/shenyu-admin-listener/shenyu-admin-listener-api/src/main/java/org/apache/shenyu/admin/listener/AbstractPathDataChangedListener.java
index 20af545df2..c0a5d8f8b5 100644
--- 
a/shenyu-admin-listener/shenyu-admin-listener-api/src/main/java/org/apache/shenyu/admin/listener/AbstractPathDataChangedListener.java
+++ 
b/shenyu-admin-listener/shenyu-admin-listener-api/src/main/java/org/apache/shenyu/admin/listener/AbstractPathDataChangedListener.java
@@ -26,12 +26,9 @@ import org.apache.shenyu.common.dto.SelectorData;
 import org.apache.shenyu.common.dto.MetaData;
 import org.apache.shenyu.common.dto.DiscoverySyncData;
 import org.apache.shenyu.common.enums.DataEventTypeEnum;
-import org.apache.shenyu.common.exception.ShenyuException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.util.List;
 
 /**
@@ -64,21 +61,16 @@ public abstract class AbstractPathDataChangedListener 
implements DataChangedList
     @Override
     public void onMetaDataChanged(final List<MetaData> changed, final 
DataEventTypeEnum eventType) {
         for (MetaData data : changed) {
-            try {
-                String metaDataPath = 
DefaultPathConstants.buildMetaDataPath(URLEncoder.encode(data.getPath(), 
"UTF-8"));
-                // delete
-                if (eventType == DataEventTypeEnum.DELETE) {
-                    deleteNode(metaDataPath);
-                    LOG.debug("[DataChangedListener] delete appKey {}", 
metaDataPath);
-                    continue;
-                }
-                // create or update
-                createOrUpdate(metaDataPath, data);
-                LOG.debug("[DataChangedListener] change metaDataPath {}", 
metaDataPath);
-            } catch (UnsupportedEncodingException e) {
-                LOG.error("[DataChangedListener] url encode error.", e);
-                throw new ShenyuException(e.getMessage());
+            String metaDataPath = 
DefaultPathConstants.buildMetaDataPath(data.getPath());
+            // delete
+            if (eventType == DataEventTypeEnum.DELETE) {
+                deleteNode(metaDataPath);
+                LOG.debug("[DataChangedListener] delete appKey {}", 
metaDataPath);
+                continue;
             }
+            // create or update
+            createOrUpdate(metaDataPath, data);
+            LOG.debug("[DataChangedListener] change metaDataPath {}", 
metaDataPath);
         }
     }
 

Reply via email to