yuz10 commented on a change in pull request #3723:
URL: https://github.com/apache/rocketmq/pull/3723#discussion_r780063305



##########
File path: 
tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java
##########
@@ -126,18 +127,19 @@ public void execute(CommandLine commandLine, Options 
options, RPCHook rpcHook)
 
                     SubscriptionGroupWrapper subscriptionGroupWrapper = 
defaultMQAdminExt.getUserSubscriptionGroup(
                         addr, 10000);
+                    String brokerName = 
CommandUtil.fetchBrokerNameByAddr(defaultMQAdminExt, addr);
 
                     if (commandLine.hasOption('t')) {
-                        filePath = filePath + "/topic.json";
-                        
MixAll.string2FileNotSafe(JSON.toJSONString(topicConfigSerializeWrapper, true), 
filePath);
-                        System.out.printf("export %s success", filePath);
-                        return;
-                    } else if (commandLine.hasOption('g')) {
-                        filePath = filePath + "/subscriptionGroup.json";
-                        
MixAll.string2FileNotSafe(JSON.toJSONString(subscriptionGroupWrapper, true), 
filePath);
-                        System.out.printf("export %s success", filePath);
-                        return;
-                    } else {
+                        String exportFilePath = filePath + "/" + brokerName + 
"/topic.json";

Review comment:
       should escape the special charactors in brokername to avoid invalid file 
path




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to