mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-21 05:44:03 +08:00
Replace findbugs by spotbugs (#4931)
This commit is contained in:
@@ -27,6 +27,10 @@
|
||||
<artifactId>rocketmq-tools</artifactId>
|
||||
<name>rocketmq-tools ${project.version}</name>
|
||||
|
||||
<properties>
|
||||
<project.root>${basedir}/..</project.root>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
|
||||
@@ -529,7 +529,8 @@ public class DefaultMQAdminExtImpl implements MQAdminExt, MQAdminExtInner {
|
||||
}
|
||||
|
||||
if (result.getOffsetTable().isEmpty()) {
|
||||
AdminToolResult.failure(AdminToolsResultCodeEnum.CONSUMER_NOT_ONLINE, "Not found the consumer group consume stats, because return offset table is empty, maybe the consumer not consume any message");
|
||||
return AdminToolResult.failure(AdminToolsResultCodeEnum.CONSUMER_NOT_ONLINE, "Not found the "
|
||||
+ "consumer group consume stats, because return offset table is empty, maybe the consumer not consume any message");
|
||||
}
|
||||
return AdminToolResult.success(result);
|
||||
}
|
||||
|
||||
@@ -105,9 +105,9 @@ import org.apache.rocketmq.tools.command.topic.UpdateTopicSubCommand;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class MQAdminStartup {
|
||||
protected static List<SubCommand> subCommandList = new ArrayList<SubCommand>();
|
||||
protected static final List<SubCommand> subCommandList = new ArrayList<SubCommand>();
|
||||
|
||||
private static String rocketmqHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY,
|
||||
private static final String rocketmqHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY,
|
||||
System.getenv(MixAll.ROCKETMQ_HOME_ENV));
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ public class ResetOffsetByTimeCommand implements SubCommand {
|
||||
}
|
||||
int queueId = -1;
|
||||
if (commandLine.hasOption("q")) {
|
||||
queueId = Integer.valueOf(commandLine.getOptionValue('q'));
|
||||
queueId = Integer.parseInt(commandLine.getOptionValue('q'));
|
||||
}
|
||||
|
||||
if (commandLine.hasOption('n')) {
|
||||
|
||||
+4
-3
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.apache.rocketmq.tools.command.topic;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.Option;
|
||||
import org.apache.commons.cli.OptionGroup;
|
||||
@@ -95,7 +96,8 @@ public class RemappingStaticTopicSubCommand implements SubCommand {
|
||||
|
||||
String mapFileName = commandLine.getOptionValue('f').trim();
|
||||
String mapData = MixAll.file2String(mapFileName);
|
||||
TopicRemappingDetailWrapper wrapper = TopicRemappingDetailWrapper.decode(mapData.getBytes(), TopicRemappingDetailWrapper.class);
|
||||
TopicRemappingDetailWrapper wrapper = TopicRemappingDetailWrapper.decode(mapData.getBytes(StandardCharsets.UTF_8),
|
||||
TopicRemappingDetailWrapper.class);
|
||||
//double check the config
|
||||
TopicQueueMappingUtils.checkNameEpochNumConsistence(topic, wrapper.getBrokerConfigMap());
|
||||
TopicQueueMappingUtils.checkAndBuildMappingItems(new ArrayList<>(TopicQueueMappingUtils.getMappingDetailFromConfig(wrapper.getBrokerConfigMap().values())), false, true);
|
||||
@@ -132,8 +134,7 @@ public class RemappingStaticTopicSubCommand implements SubCommand {
|
||||
defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
|
||||
|
||||
ClientMetadata clientMetadata = new ClientMetadata();
|
||||
Map<String, TopicConfigAndQueueMapping> brokerConfigMap = new HashMap<>();
|
||||
Map<Integer, TopicQueueMappingOne> globalIdMap = new HashMap<>();
|
||||
Map<String, TopicConfigAndQueueMapping> brokerConfigMap;
|
||||
Set<String> targetBrokers = new HashSet<>();
|
||||
|
||||
try {
|
||||
|
||||
+3
-1
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.apache.rocketmq.tools.command.topic;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.Option;
|
||||
import org.apache.commons.cli.OptionGroup;
|
||||
@@ -97,7 +98,8 @@ public class UpdateStaticTopicSubCommand implements SubCommand {
|
||||
String topic = commandLine.getOptionValue('t').trim();
|
||||
String mapFileName = commandLine.getOptionValue('f').trim();
|
||||
String mapData = MixAll.file2String(mapFileName);
|
||||
TopicRemappingDetailWrapper wrapper = TopicRemappingDetailWrapper.decode(mapData.getBytes(), TopicRemappingDetailWrapper.class);
|
||||
TopicRemappingDetailWrapper wrapper = TopicRemappingDetailWrapper.decode(mapData.getBytes(StandardCharsets.UTF_8),
|
||||
TopicRemappingDetailWrapper.class);
|
||||
//double check the config
|
||||
TopicQueueMappingUtils.checkNameEpochNumConsistence(topic, wrapper.getBrokerConfigMap());
|
||||
boolean force = false;
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.TreeMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.apache.rocketmq.client.consumer.DefaultMQPullConsumer;
|
||||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
||||
import org.apache.rocketmq.client.consumer.PullResult;
|
||||
@@ -134,9 +135,8 @@ public class MonitorService {
|
||||
}
|
||||
|
||||
private String instanceName() {
|
||||
String name =
|
||||
System.currentTimeMillis() + new Random().nextInt() + this.monitorConfig.getNamesrvAddr();
|
||||
|
||||
final int randomInteger = RandomUtils.nextInt(0, Integer.MAX_VALUE);
|
||||
String name = System.currentTimeMillis() + randomInteger + this.monitorConfig.getNamesrvAddr();
|
||||
return "MonitorService_" + name.hashCode();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user