[ISSUE #5108] Bump checkstyle to 3.2.0 (#5109)

* Bump checkstyle to 3.2.0

* Fix checkstyle
This commit is contained in:
Aaron Ai
2022-09-18 11:17:36 +08:00
committed by GitHub
parent 8ef88670a3
commit c185c60b0f
24 changed files with 40 additions and 40 deletions
@@ -50,7 +50,7 @@ public class Permission {
return false;
}
if ((neededPerm & ANY) > 0) {
return ((ownedPerm & PUB) > 0) || ((ownedPerm & SUB) > 0);
return (ownedPerm & PUB) > 0 || (ownedPerm & SUB) > 0;
}
return (neededPerm & ownedPerm) > 0;
}
@@ -1510,7 +1510,7 @@ public class BrokerController {
this.shouldStartTime = System.currentTimeMillis() + messageStoreConfig.getDisappearTimeAfterStart();
if ((messageStoreConfig.getTotalReplicas() > 1 && this.brokerConfig.isEnableSlaveActingMaster()) || this.brokerConfig.isEnableControllerMode()) {
if (messageStoreConfig.getTotalReplicas() > 1 && this.brokerConfig.isEnableSlaveActingMaster() || this.brokerConfig.isEnableControllerMode()) {
isIsolated = true;
}
@@ -842,7 +842,7 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
}
SearchOffsetResponseHeader offsetResponseHeader = (SearchOffsetResponseHeader) rpcResponse.getHeader();
if (offsetResponseHeader.getOffset() < 0
|| (item.checkIfEndOffsetDecided() && offsetResponseHeader.getOffset() >= item.getEndOffset())) {
|| item.checkIfEndOffsetDecided() && offsetResponseHeader.getOffset() >= item.getEndOffset()) {
continue;
} else {
offset = item.computeStaticQueueOffsetStrictly(offsetResponseHeader.getOffset());
@@ -137,8 +137,8 @@ public class PopBufferMergeService extends ServiceThread {
// 1. just offset & stored, not processed by scan
// 2. ck is buffer(acked)
// 3. ck is buffer(not all acked), all ak are stored and ck is stored
if ((pointWrapper.isJustOffset() && pointWrapper.isCkStored()) || isCkDone(pointWrapper)
|| (isCkDoneForFinish(pointWrapper) && pointWrapper.isCkStored())) {
if (pointWrapper.isJustOffset() && pointWrapper.isCkStored() || isCkDone(pointWrapper)
|| isCkDoneForFinish(pointWrapper) && pointWrapper.isCkStored()) {
if (commitOffset(pointWrapper)) {
queue.poll();
} else {
@@ -218,8 +218,8 @@ public class PopBufferMergeService extends ServiceThread {
PopCheckPointWrapper pointWrapper = entry.getValue();
// just process offset(already stored at pull thread), or buffer ck(not stored and ack finish)
if ((pointWrapper.isJustOffset() && pointWrapper.isCkStored()) || isCkDone(pointWrapper)
|| (isCkDoneForFinish(pointWrapper) && pointWrapper.isCkStored())) {
if (pointWrapper.isJustOffset() && pointWrapper.isCkStored() || isCkDone(pointWrapper)
|| isCkDoneForFinish(pointWrapper) && pointWrapper.isCkStored()) {
if (brokerController.getBrokerConfig().isEnablePopLog()) {
POP_LOGGER.info("[PopBuffer]ck done, {}", pointWrapper);
}
@@ -231,7 +231,7 @@ public class PopBufferMergeService extends ServiceThread {
PopCheckPoint point = pointWrapper.getCk();
long now = System.currentTimeMillis();
boolean removeCk = this.serving ? false : true;
boolean removeCk = !this.serving;
// ck will be timeout
if (point.getReviveTime() - now < brokerController.getBrokerConfig().getPopCkStayBufferTimeOut()) {
removeCk = true;
@@ -173,7 +173,7 @@ public class PopReviveService extends ServiceThread {
private boolean reachTail(PullResult pullResult, long offset) {
return pullResult.getPullStatus() == PullStatus.NO_NEW_MSG
|| (pullResult.getPullStatus() == PullStatus.OFFSET_ILLEGAL && offset == pullResult.getMaxOffset());
|| pullResult.getPullStatus() == PullStatus.OFFSET_ILLEGAL && offset == pullResult.getMaxOffset();
}
private MessageExt getBizMessage(String topic, long offset, int queueId, String brokerName) {
@@ -212,16 +212,16 @@ public class TransactionalMessageServiceImpl implements TransactionalMessageServ
}
}
} else {
if ((0 <= valueOfCurrentMinusBorn) && (valueOfCurrentMinusBorn < checkImmunityTime)) {
if (0 <= valueOfCurrentMinusBorn && valueOfCurrentMinusBorn < checkImmunityTime) {
log.debug("New arrived, the miss offset={}, check it later checkImmunity={}, born={}", i,
checkImmunityTime, new Date(msgExt.getBornTimestamp()));
break;
}
}
List<MessageExt> opMsg = pullResult.getMsgFoundList();
boolean isNeedCheck = (opMsg == null && valueOfCurrentMinusBorn > checkImmunityTime)
|| (opMsg != null && (opMsg.get(opMsg.size() - 1).getBornTimestamp() - startTime > transactionTimeout))
|| (valueOfCurrentMinusBorn <= -1);
boolean isNeedCheck = opMsg == null && valueOfCurrentMinusBorn > checkImmunityTime
|| opMsg != null && opMsg.get(opMsg.size() - 1).getBornTimestamp() - startTime > transactionTimeout
|| valueOfCurrentMinusBorn <= -1;
if (isNeedCheck) {
if (!putBackHalfMsgQueue(msgExt, i)) {
@@ -438,7 +438,7 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService {
final Object objLock = messageQueueLock.fetchLockObject(this.messageQueue);
synchronized (objLock) {
if (MessageModel.BROADCASTING.equals(ConsumeMessageOrderlyService.this.defaultMQPushConsumerImpl.messageModel())
|| (this.processQueue.isLocked() && !this.processQueue.isLockExpired())) {
|| this.processQueue.isLocked() && !this.processQueue.isLockExpired()) {
final long beginTime = System.currentTimeMillis();
for (boolean continueConsume = true; continueConsume; ) {
if (this.processQueue.isDropped()) {
@@ -726,8 +726,8 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
private void sendMessageBack(MessageExt msg, int delayLevel, final String brokerName, final MessageQueue mq)
throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
try {
if ((brokerName != null && brokerName.startsWith(MixAll.LOGICAL_QUEUE_MOCK_BROKER_PREFIX))
|| (mq != null && mq.getBrokerName().startsWith(MixAll.LOGICAL_QUEUE_MOCK_BROKER_PREFIX))) {
if (brokerName != null && brokerName.startsWith(MixAll.LOGICAL_QUEUE_MOCK_BROKER_PREFIX)
|| mq != null && mq.getBrokerName().startsWith(MixAll.LOGICAL_QUEUE_MOCK_BROKER_PREFIX)) {
sendMessageBackAsNormalMessage(msg);
} else {
String brokerAddr = (null != brokerName) ? this.mQClientFactory.findBrokerAddressInPublish(brokerName)
@@ -82,7 +82,7 @@ public class DataVersion extends RemotingSerializable {
return counter.longValue() == version.counter.longValue();
}
return (null == counter) && (null == version.counter);
return null == counter && null == version.counter;
}
@@ -97,8 +97,8 @@ public class PolishExpr {
for (int i = 0; i < size; i++) {
int chValue = (int) expression.charAt(i);
if ((97 <= chValue && chValue <= 122) || (65 <= chValue && chValue <= 90)
|| (49 <= chValue && chValue <= 57) || 95 == chValue) {
if (97 <= chValue && chValue <= 122 || 65 <= chValue && chValue <= 90
|| 49 <= chValue && chValue <= 57 || 95 == chValue) {
if (Type.OPERATOR == preType || Type.SEPAERATOR == preType || Type.NULL == preType
|| Type.PARENTHESIS == preType) {
@@ -141,7 +141,7 @@ public class ConsumerRunningInfo extends RemotingSerializable {
mq,
System.currentTimeMillis() - pq.getLastLockTimestamp()));
} else {
if (pq.isDroped() && (pq.getTryUnlockTimes() > 0)) {
if (pq.isDroped() && pq.getTryUnlockTimes() > 0) {
sb.append(String.format("%s %s unlock %d times, still failed%n",
clientId,
mq,
@@ -97,8 +97,8 @@ public class TopicQueueMappingDetail extends TopicQueueMappingInfo {
public static boolean checkIfAsPhysical(TopicQueueMappingDetail mappingDetail, Integer globalId) {
List<LogicQueueMappingItem> mappingItems = getMappingInfo(mappingDetail, globalId);
return mappingItems == null
|| (mappingItems.size() == 1
&& mappingItems.get(0).getLogicOffset() == 0);
|| mappingItems.size() == 1
&& mappingItems.get(0).getLogicOffset() == 0;
}
public ConcurrentMap<Integer, List<LogicQueueMappingItem>> getHostedQueues() {
@@ -140,7 +140,7 @@ public class DefaultBrokerHeartbeatManager implements BrokerHeartbeatManager {
long realConfirmOffset = Optional.ofNullable(confirmOffset).orElse(-1L);
prev.setLastUpdateTimestamp(System.currentTimeMillis());
if (realEpoch > prev.getEpoch() || (realEpoch == prev.getEpoch() && realMaxOffset > prev.getMaxOffset())) {
if (realEpoch > prev.getEpoch() || realEpoch == prev.getEpoch() && realMaxOffset > prev.getMaxOffset()) {
prev.setEpoch(realEpoch);
prev.setMaxOffset(realMaxOffset);
prev.setConfirmOffset(realConfirmOffset);
@@ -175,7 +175,7 @@ public class LoggingBuilder {
}
public void append(final LoggingEvent event) {
if ((dispatcher == null) || !dispatcher.isAlive() || (bufferSize <= 0)) {
if (dispatcher == null || !dispatcher.isAlive() || bufferSize <= 0) {
synchronized (appenderPipeline) {
appenderPipeline.appendLoopOnAppenders(event);
}
@@ -383,7 +383,7 @@ public class LoggingBuilder {
int bufferSize = buffer.size();
isActive = !parent.closed;
while ((bufferSize == 0) && isActive) {
while (bufferSize == 0 && isActive) {
buffer.wait();
bufferSize = buffer.size();
isActive = !parent.closed;
@@ -61,7 +61,7 @@ public class ClientRequestProcessor implements NettyRequestProcessor {
byte[] content;
Boolean standardJsonOnly = requestHeader.getAcceptStandardJsonOnly();
if (request.getVersion() >= MQVersion.Version.V4_9_4.ordinal() || (null != standardJsonOnly && standardJsonOnly)) {
if (request.getVersion() >= MQVersion.Version.V4_9_4.ordinal() || null != standardJsonOnly && standardJsonOnly) {
content = topicRouteData.encode(SerializerFeature.BrowserCompatible,
SerializerFeature.QuoteFieldNames, SerializerFeature.SkipTransientField,
SerializerFeature.MapSortField);
@@ -157,7 +157,7 @@ public class DefaultPromise<V> implements Promise<V> {
}
private boolean isSuccess() {
return isDone() && (exception == null);
return isDone() && exception == null;
}
private void timeoutSoCancel() {
+1 -1
View File
@@ -147,7 +147,7 @@
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
<maven-help-plugin.version>2.2</maven-help-plugin.version>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<maven-checkstyle-plugin.version>3.2.0</maven-checkstyle-plugin.version>
<apache-rat-plugin.version>0.12</apache-rat-plugin.version>
<maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
@@ -99,8 +99,8 @@ public class DefaultHAService implements HAService {
boolean result = this.connectionCount.get() > 0;
result =
result
&& ((masterPutWhere - this.push2SlaveMaxOffset.get()) < this.defaultMessageStore
.getMessageStoreConfig().getHaMaxGapNotInSync());
&& masterPutWhere - this.push2SlaveMaxOffset.get() < this.defaultMessageStore
.getMessageStoreConfig().getHaMaxGapNotInSync();
return result;
}
@@ -180,8 +180,8 @@ public class IndexFile {
public boolean isTimeMatched(final long begin, final long end) {
boolean result = begin < this.indexHeader.getBeginTimestamp() && end > this.indexHeader.getEndTimestamp();
result = result || (begin >= this.indexHeader.getBeginTimestamp() && begin <= this.indexHeader.getEndTimestamp());
result = result || (end >= this.indexHeader.getBeginTimestamp() && end <= this.indexHeader.getEndTimestamp());
result = result || begin >= this.indexHeader.getBeginTimestamp() && begin <= this.indexHeader.getEndTimestamp();
result = result || end >= this.indexHeader.getBeginTimestamp() && end <= this.indexHeader.getEndTimestamp();
return result;
}
@@ -219,7 +219,7 @@ public class IndexFile {
timeDiff *= 1000L;
long timeRead = this.indexHeader.getBeginTimestamp() + timeDiff;
boolean timeMatched = (timeRead >= begin) && (timeRead <= end);
boolean timeMatched = timeRead >= begin && timeRead <= end;
if (keyHash == keyHashRead && timeMatched) {
phyOffsets.add(phyOffsetRead);
@@ -504,7 +504,7 @@ public class BatchConsumeQueue implements ConsumeQueueInterface, FileQueueLifeCy
}
long behind = System.currentTimeMillis() - storeTime;
if (behind > 10000 && (System.currentTimeMillis() % 10000 == 0)) {
if (behind > 10000 && System.currentTimeMillis() % 10000 == 0) {
String flag = "LEVEL" + (behind / 10000);
log.warn("Reput behind {} topic:{} queue:{} offset:{} behind:{}", flag, topic, queueId, offset, behind);
}
@@ -1637,7 +1637,7 @@ public class DefaultMQAdminExtImpl implements MQAdminExt, MQAdminExtInner {
Iterator<Entry<String, TopicConfig>> iterator = topicConfigSerializeWrapper.getTopicConfigTable().entrySet().iterator();
while (iterator.hasNext()) {
String topic = iterator.next().getKey();
if (topicList.getTopicList().contains(topic) || (!specialTopic && (topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX) || topic.startsWith(MixAll.DLQ_GROUP_TOPIC_PREFIX)))) {
if (topicList.getTopicList().contains(topic) || !specialTopic && (topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX) || topic.startsWith(MixAll.DLQ_GROUP_TOPIC_PREFIX))) {
iterator.remove();
}
}
@@ -294,7 +294,7 @@ public class MQAdminStartup {
private static SubCommand findSubCommand(final String name) {
for (SubCommand cmd : SUB_COMMANDS) {
if (cmd.commandName().equalsIgnoreCase(name) || (cmd.commandAlias() != null && cmd.commandAlias().equalsIgnoreCase(name))) {
if (cmd.commandName().equalsIgnoreCase(name) || cmd.commandAlias() != null && cmd.commandAlias().equalsIgnoreCase(name)) {
return cmd;
}
}
@@ -91,8 +91,8 @@ public class StatsAllSubCommand implements SubCommand {
} catch (Exception e) {
}
if (!activeTopic || (inMsgCntToday > 0) ||
(outMsgCntToday > 0)) {
if (!activeTopic || inMsgCntToday > 0 ||
outMsgCntToday > 0) {
System.out.printf("%-64s %-64s %12d %11.2f %11.2f %14d %14d%n",
UtilAll.frontStringAtLeast(topic, 64),
@@ -106,7 +106,7 @@ public class StatsAllSubCommand implements SubCommand {
}
}
} else {
if (!activeTopic || (inMsgCntToday > 0)) {
if (!activeTopic || inMsgCntToday > 0) {
System.out.printf("%-64s %-64s %12d %11.2f %11s %14d %14s%n",
UtilAll.frontStringAtLeast(topic, 64),
@@ -141,7 +141,7 @@ public class UpdateStaticTopicSubCommand implements SubCommand {
try {
defaultMQAdminExt.start();
if ((!commandLine.hasOption("b") && !commandLine.hasOption('c'))
if (!commandLine.hasOption("b") && !commandLine.hasOption('c')
|| !commandLine.hasOption("qn")) {
ServerUtil.printCommandLineHelp("mqadmin " + this.commandName(), options);
return;