Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #5108] Bump checkstyle to 3.2.0 #5109

Merged
merged 2 commits into from
Sep 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static boolean checkPermission(byte neededPerm, byte ownedPerm) {
return false;
}
if ((neededPerm & ANY) > 0) {
return ((ownedPerm & PUB) > 0) || ((ownedPerm & SUB) > 0);
return (ownedPerm & PUB) > 0 || (ownedPerm & SUB) > 0;
}
return (neededPerm & ownedPerm) > 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ public void start() throws Exception {

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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ private RemotingCommand rewriteRequestForStaticTopic(SearchOffsetRequestHeader r
}
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ private int scanCommitOffset() {
// 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 {
Expand Down Expand Up @@ -218,8 +218,8 @@ private void scan() {
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);
}
Expand All @@ -231,7 +231,7 @@ private void scan() {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected List<MessageExt> getReviveMessage(long offset, int queueId) {

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,16 @@ public void check(long transactionTimeout, int transactionCheckMax,
}
}
} 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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public void run() {
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,8 @@ public void sendMessageBack(MessageExt msg, int delayLevel, final MessageQueue m
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public boolean equals(final Object o) {
return counter.longValue() == version.counter.longValue();
}

return (null == counter) && (null == version.counter);
return null == counter && null == version.counter;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ private static List<Op> participle(String expression) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static String analyzeProcessQueue(final String clientId, ConsumerRunningI
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public static TopicQueueMappingInfo cloneAsMappingInfo(TopicQueueMappingDetail m
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void onBrokerHeartbeat(String clusterName, String brokerAddr, Integer epo
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void addAppender(final Appender newAppender) {
}

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);
}
Expand Down Expand Up @@ -383,7 +383,7 @@ public void run() {
int bufferSize = buffer.size();
isActive = !parent.closed;

while ((bufferSize == 0) && isActive) {
while (bufferSize == 0 && isActive) {
buffer.wait();
bufferSize = buffer.size();
isActive = !parent.closed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public RemotingCommand getRouteInfoByTopic(ChannelHandlerContext ctx,

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void notifyListeners() {
}

private boolean isSuccess() {
return isDone() && (exception == null);
return isDone() && exception == null;
}

private void timeoutSoCancel() {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public boolean isSlaveOK(final long masterPutWhere) {
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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public long getEndPhyOffset() {

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;
}

Expand Down Expand Up @@ -219,7 +219,7 @@ public void selectPhyOffset(final List<Long> phyOffsets, final String key, final
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ boolean putBatchMessagePositionInfo(final long offset, final int size, final lon
}

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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ public TopicConfigSerializeWrapper getUserTopicConfig(final String brokerAddr, f
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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private static void printHelp() {

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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public static void printTopicDetail(final DefaultMQAdminExt admin, final String
} 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),
Expand All @@ -106,7 +106,7 @@ public static void printTopicDetail(final DefaultMQAdminExt admin, final String
}
}
} 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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void execute(final CommandLine commandLine, final Options options,

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;
Expand Down