From cc0b3d091814a390107b8e733dd8a5427ff49296 Mon Sep 17 00:00:00 2001 From: lindzh Date: Wed, 20 Dec 2017 15:48:33 +0800 Subject: [PATCH] [ROCKETMQ-336] Wrong format System.out.printf used in mqadmin (#208) --- .../main/java/org/apache/rocketmq/broker/BrokerStartup.java | 3 +-- .../main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java | 4 ++-- .../tools/command/cluster/CLusterSendMsgRTCommand.java | 2 +- .../rocketmq/tools/command/consumer/ConsumerSubCommand.java | 2 +- .../tools/command/message/PrintMessageSubCommand.java | 4 ++-- .../rocketmq/tools/command/topic/UpdateTopicSubCommand.java | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java b/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java index e768c7f9..40d20863 100644 --- a/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java +++ b/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java @@ -134,8 +134,7 @@ public class BrokerStartup { MixAll.properties2Object(ServerUtil.commandLine2Properties(commandLine), brokerConfig); if (null == brokerConfig.getRocketmqHome()) { - System.out.printf("Please set the " + MixAll.ROCKETMQ_HOME_ENV - + " variable in your environment to match the location of the RocketMQ installation"); + System.out.printf("Please set the %s variable in your environment to match the location of the RocketMQ installation", MixAll.ROCKETMQ_HOME_ENV); System.exit(-2); } diff --git a/namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java b/namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java index 0a0c6562..d7a2b2b6 100644 --- a/namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java +++ b/namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java @@ -72,7 +72,7 @@ public class NamesrvStartup { namesrvConfig.setConfigStorePath(file); - System.out.printf("load config properties file OK, " + file + "%n"); + System.out.printf("load config properties file OK, %s%n", file); in.close(); } } @@ -123,7 +123,7 @@ public class NamesrvStartup { String tip = "The Name Server boot success. serializeType=" + RemotingCommand.getSerializeTypeConfigInThisServer(); log.info(tip); - System.out.printf(tip + "%n"); + System.out.printf("%s%n", tip); return controller; } catch (Throwable e) { diff --git a/tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java b/tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java index 37d66e4c..ecbe1f38 100644 --- a/tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java +++ b/tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java @@ -171,7 +171,7 @@ public class CLusterSendMsgRTCommand implements SubCommand { failCount ); } else { - System.out.printf(String.format("%s|%s|%s|%s|%s%n", getCurTime(), + System.out.printf("%s", String.format("%s|%s|%s|%s|%s%n", getCurTime(), machineRoom, clusterName, brokerName, new BigDecimal(rt).setScale(0, BigDecimal.ROUND_HALF_UP))); } diff --git a/tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java b/tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java index a6df8ea8..f3b1fccf 100644 --- a/tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java +++ b/tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java @@ -126,7 +126,7 @@ public class ConsumerSubCommand implements SubCommand { ConsumerRunningInfo consumerRunningInfo = defaultMQAdminExt.getConsumerRunningInfo(group, clientId, jstack); if (consumerRunningInfo != null) { - System.out.printf(consumerRunningInfo.formatString()); + System.out.printf("%s", consumerRunningInfo.formatString()); } } } catch (Exception e) { diff --git a/tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java b/tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java index c8fced3b..b204f0ab 100644 --- a/tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java +++ b/tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java @@ -146,11 +146,11 @@ public class PrintMessageSubCommand implements SubCommand { printMessage(pullResult.getMsgFoundList(), charsetName, printBody); break; case NO_MATCHED_MSG: - System.out.printf(mq + " no matched msg. status=%s, offset=%s", pullResult.getPullStatus(), offset); + System.out.printf("%s no matched msg. status=%s, offset=%s", mq, pullResult.getPullStatus(), offset); break; case NO_NEW_MSG: case OFFSET_ILLEGAL: - System.out.printf(mq + " print msg finished. status=%s, offset=%s", pullResult.getPullStatus(), offset); + System.out.printf("%s print msg finished. status=%s, offset=%s", mq, pullResult.getPullStatus(), offset); break READQ; } } catch (Exception e) { diff --git a/tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java b/tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java index 8fdb9d3d..c9c8a88f 100644 --- a/tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java +++ b/tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java @@ -138,7 +138,7 @@ public class UpdateTopicSubCommand implements SubCommand { String brokerName = CommandUtil.fetchBrokerNameByAddr(defaultMQAdminExt, addr); String orderConf = brokerName + ":" + topicConfig.getWriteQueueNums(); defaultMQAdminExt.createOrUpdateOrderConf(topicConfig.getTopicName(), orderConf, false); - System.out.printf(String.format("set broker orderConf. isOrder=%s, orderConf=[%s]", + System.out.printf("%s", String.format("set broker orderConf. isOrder=%s, orderConf=[%s]", isOrder, orderConf.toString())); } System.out.printf("create topic to %s success.%n", addr); -- GitLab