Skip to content

Commit 1bbd4cd

Browse files
lindzhdongeforever
authored andcommitted
[ROCKETMQ-291] Fix System.out.printf throws UnknownFormatConversionException
Author: lindzh <linsony0@163.com> Closes apache#168 from lindzh/fix_print.
1 parent dc4f368 commit 1bbd4cd

File tree

18 files changed

+26
-26
lines changed

18 files changed

+26
-26
lines changed

example/src/main/java/org/apache/rocketmq/example/broadcast/PushConsumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static void main(String[] args) throws InterruptedException, MQClientExce
4242
@Override
4343
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
4444
ConsumeConcurrentlyContext context) {
45-
System.out.printf(Thread.currentThread().getName() + " Receive New Messages: " + msgs + "%n");
45+
System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
4646
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
4747
}
4848
});

example/src/main/java/org/apache/rocketmq/example/filter/Consumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static void main(String[] args) throws InterruptedException, MQClientExce
4444
@Override
4545
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
4646
ConsumeConcurrentlyContext context) {
47-
System.out.printf(Thread.currentThread().getName() + " Receive New Messages: " + msgs + "%n");
47+
System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
4848
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
4949
}
5050
});

example/src/main/java/org/apache/rocketmq/example/filter/SqlConsumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static void main(String[] args) {
4545
@Override
4646
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
4747
ConsumeConcurrentlyContext context) {
48-
System.out.printf(Thread.currentThread().getName() + " Receive New Messages: " + msgs + "%n");
48+
System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
4949
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
5050
}
5151
});

example/src/main/java/org/apache/rocketmq/example/ordermessage/Consumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void main(String[] args) throws MQClientException {
4141
@Override
4242
public ConsumeOrderlyStatus consumeMessage(List<MessageExt> msgs, ConsumeOrderlyContext context) {
4343
context.setAutoCommit(false);
44-
System.out.printf(Thread.currentThread().getName() + " Receive New Messages: " + msgs + "%n");
44+
System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
4545
this.consumeTimes.incrementAndGet();
4646
if ((this.consumeTimes.get() % 2) == 0) {
4747
return ConsumeOrderlyStatus.SUCCESS;

example/src/main/java/org/apache/rocketmq/example/quickstart/Consumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static void main(String[] args) throws InterruptedException, MQClientExce
6767
@Override
6868
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
6969
ConsumeConcurrentlyContext context) {
70-
System.out.printf(Thread.currentThread().getName() + " Receive New Messages: " + msgs + "%n");
70+
System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
7171
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
7272
}
7373
});

example/src/main/java/org/apache/rocketmq/example/simple/PullConsumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static void main(String[] args) throws MQClientException {
3434

3535
Set<MessageQueue> mqs = consumer.fetchSubscribeMessageQueues("TopicTest1");
3636
for (MessageQueue mq : mqs) {
37-
System.out.printf("Consume from the queue: " + mq + "%n");
37+
System.out.printf("Consume from the queue: %s%n", mq);
3838
SINGLE_MQ:
3939
while (true) {
4040
try {

example/src/main/java/org/apache/rocketmq/example/simple/PushConsumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static void main(String[] args) throws InterruptedException, MQClientExce
3737

3838
@Override
3939
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
40-
System.out.printf(Thread.currentThread().getName() + " Receive New Messages: " + msgs + "%n");
40+
System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
4141
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
4242
}
4343
});

example/src/main/java/org/apache/rocketmq/example/transaction/TransactionCheckListenerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class TransactionCheckListenerImpl implements TransactionCheckListener {
2626

2727
@Override
2828
public LocalTransactionState checkLocalTransactionState(MessageExt msg) {
29-
System.out.printf("server checking TrMsg " + msg.toString() + "%n");
29+
System.out.printf("server checking TrMsg %s%n", msg);
3030

3131
int value = transactionIndex.getAndIncrement();
3232
if ((value % 6) == 0) {

filtersrv/src/main/java/org/apache/rocketmq/filtersrv/FiltersrvStartup.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static FiltersrvController createController(String[] args) {
9292
Properties properties = new Properties();
9393
properties.load(in);
9494
MixAll.properties2Object(properties, filtersrvConfig);
95-
System.out.printf("load config properties file OK, " + file + "%n");
95+
System.out.printf("load config properties file OK, %s%n", file);
9696
in.close();
9797

9898
String port = properties.getProperty("listenPort");
@@ -116,8 +116,7 @@ public static FiltersrvController createController(String[] args) {
116116

117117
MixAll.properties2Object(ServerUtil.commandLine2Properties(commandLine), filtersrvConfig);
118118
if (null == filtersrvConfig.getRocketmqHome()) {
119-
System.out.printf("Please set the " + MixAll.ROCKETMQ_HOME_ENV
120-
+ " variable in your environment to match the location of the RocketMQ installation%n");
119+
System.out.printf("Please set the %s variable in your environment to match the location of the RocketMQ installation%n", MixAll.ROCKETMQ_HOME_ENV);
121120
System.exit(-2);
122121
}
123122

namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static NamesrvController main0(String[] args) {
9696
MixAll.properties2Object(ServerUtil.commandLine2Properties(commandLine), namesrvConfig);
9797

9898
if (null == namesrvConfig.getRocketmqHome()) {
99-
System.out.printf("Please set the " + MixAll.ROCKETMQ_HOME_ENV + " variable in your environment to match the location of the RocketMQ installation%n");
99+
System.out.printf("Please set the %s variable in your environment to match the location of the RocketMQ installation%n", MixAll.ROCKETMQ_HOME_ENV);
100100
System.exit(-2);
101101
}
102102

0 commit comments

Comments
 (0)