You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/04/30 06:48:53 UTC

[GitHub] [rocketmq-mqtt] YxAc commented on a diff in pull request #89: [ISSUE #22] Improving codeCov for mqtt.common

YxAc commented on code in PR #89:
URL: https://github.com/apache/rocketmq-mqtt/pull/89#discussion_r862317524


##########
mqtt-common/src/main/java/org/apache/rocketmq/mqtt/common/util/NamespaceUtil.java:
##########
@@ -24,45 +24,35 @@ public class NamespaceUtil {
     private static final int RESOURCE_LENGTH = 2;
     public static final String MQ_DEFAULT_NAMESPACE_NAME = "DEFAULT_INSTANCE";
 
-    public NamespaceUtil() {
-    }
-
     public static String encodeToNamespaceResource(String namespace, String resource) {
-        return resource != null && namespace != null ? StringUtils.join(new String[]{namespace, "%", resource}) : resource;
+        return resource != null && namespace != null ? StringUtils.join(namespace, NAMESPACE_SPLITER, resource) : resource;
     }
 
     public static String decodeOriginResource(String resource) {
-        if (resource != null && resource.contains("%")) {
-            int firstIndex = resource.indexOf("%");
+        if (resource != null && resource.contains(NAMESPACE_SPLITER)) {
+            int firstIndex = resource.indexOf(NAMESPACE_SPLITER);

Review Comment:
   using defined constant



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org