You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/08/09 02:49:37 UTC

[GitHub] [rocketmq] zhaohai1299002788 opened a new pull request #3235: Dev constants equals

zhaohai1299002788 opened a new pull request #3235:
URL: https://github.com/apache/rocketmq/pull/3235


   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   The equals method of an object is easy to throw a null pointer. You should use a constant or an object with a certain value to call equals.
   
   ## Brief changelog
   
   Use constants or objects with specific values to call equals
   
   ## Verifying this change
   
   Scanning through the tool has fixed this issue
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] codecov-commenter commented on pull request #3235: Use constants or objects with specific values to call equals

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #3235:
URL: https://github.com/apache/rocketmq/pull/3235#issuecomment-895697307


   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/3235?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3235](https://codecov.io/gh/apache/rocketmq/pull/3235?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (67ebc46) into [develop](https://codecov.io/gh/apache/rocketmq/commit/44bdeedad2d0e28717f5012d375d12af76305bb5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (44bdeed) will **decrease** coverage by `0.11%`.
   > The diff coverage is `15.78%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/rocketmq/pull/3235/graphs/tree.svg?width=650&height=150&src=pr&token=4w0sxP1wZv&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/rocketmq/pull/3235?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #3235      +/-   ##
   =============================================
   - Coverage      48.07%   47.95%   -0.12%     
   + Complexity      4573     4557      -16     
   =============================================
     Files            552      554       +2     
     Lines          36521    36523       +2     
     Branches        4818     4818              
   =============================================
   - Hits           17557    17515      -42     
   - Misses         16749    16789      +40     
   - Partials        2215     2219       +4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/3235?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../rocketmq/broker/offset/ConsumerOffsetManager.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvb2Zmc2V0L0NvbnN1bWVyT2Zmc2V0TWFuYWdlci5qYXZh) | `15.70% <ø> (ø)` | |
   | [...cketmq/broker/processor/QueryMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1F1ZXJ5TWVzc2FnZVByb2Nlc3Nvci5qYXZh) | `5.71% <0.00%> (ø)` | |
   | [.../broker/subscription/SubscriptionGroupManager.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvc3Vic2NyaXB0aW9uL1N1YnNjcmlwdGlvbkdyb3VwTWFuYWdlci5qYXZh) | `70.58% <ø> (ø)` | |
   | [...ache/rocketmq/broker/topic/TopicConfigManager.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvdG9waWMvVG9waWNDb25maWdNYW5hZ2VyLmphdmE=) | `59.07% <ø> (ø)` | |
   | [...ketmq/client/consumer/DefaultLitePullConsumer.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvY29uc3VtZXIvRGVmYXVsdExpdGVQdWxsQ29uc3VtZXIuamF2YQ==) | `74.53% <ø> (ø)` | |
   | [...ocketmq/client/consumer/DefaultMQPullConsumer.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvY29uc3VtZXIvRGVmYXVsdE1RUHVsbENvbnN1bWVyLmphdmE=) | `33.33% <ø> (ø)` | |
   | [...ocketmq/client/consumer/DefaultMQPushConsumer.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvY29uc3VtZXIvRGVmYXVsdE1RUHVzaENvbnN1bWVyLmphdmE=) | `54.54% <ø> (ø)` | |
   | [...client/consumer/store/RemoteBrokerOffsetStore.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvY29uc3VtZXIvc3RvcmUvUmVtb3RlQnJva2VyT2Zmc2V0U3RvcmUuamF2YQ==) | `64.86% <ø> (ø)` | |
   | [...g/apache/rocketmq/client/impl/MQClientAPIImpl.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9NUUNsaWVudEFQSUltcGwuamF2YQ==) | `12.18% <0.00%> (ø)` | |
   | [...pl/consumer/ConsumeMessageConcurrentlyService.java](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9Db25zdW1lTWVzc2FnZUNvbmN1cnJlbnRseVNlcnZpY2UuamF2YQ==) | `48.54% <ø> (+0.97%)` | :arrow_up: |
   | ... and [75 more](https://codecov.io/gh/apache/rocketmq/pull/3235/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/rocketmq/pull/3235?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/rocketmq/pull/3235?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [44bdeed...67ebc46](https://codecov.io/gh/apache/rocketmq/pull/3235?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] caigy commented on a change in pull request #3235: Use constants or objects with specific values to call equals

Posted by GitBox <gi...@apache.org>.
caigy commented on a change in pull request #3235:
URL: https://github.com/apache/rocketmq/pull/3235#discussion_r708814047



##########
File path: common/src/main/java/org/apache/rocketmq/common/constant/SymbolConstants.java
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.common.constant;
+
+public class SymbolConstants {
+
+    public static final String GREATER_AND_EQUAL_CONSTANT = ">=";

Review comment:
       GREATER_**OR**_EQUAL_CONSTANT may be more precise.

##########
File path: common/src/main/java/org/apache/rocketmq/common/constant/SymbolConstants.java
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.common.constant;
+
+public class SymbolConstants {
+
+    public static final String GREATER_AND_EQUAL_CONSTANT = ">=";
+
+    public static final String LESS_THAN_CONSTANT = "<";
+
+    public static final String GREATER_CONSTANT = ">";
+
+    public static final String LESS_THAN_AND_EQUAL_CONSTANT = "<=";

Review comment:
       LESS_**OR**_EQUAL_CONSTANT may be more precise.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] odbozhou commented on pull request #3235: Use constants or objects with specific values to call equals

Posted by GitBox <gi...@apache.org>.
odbozhou commented on pull request #3235:
URL: https://github.com/apache/rocketmq/pull/3235#issuecomment-895749379


   Please submit an issue first, pr associate this issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] coveralls commented on pull request #3235: Use constants or objects with specific values to call equals

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #3235:
URL: https://github.com/apache/rocketmq/pull/3235#issuecomment-894994636


   
   [![Coverage Status](https://coveralls.io/builds/41992324/badge)](https://coveralls.io/builds/41992324)
   
   Coverage increased (+0.1%) to 54.2% when pulling **826029e4d77ab44b644e2dacb90f3fcd9be3c249 on zhaohai1299002788:dev-constants-equals** into **44bdeedad2d0e28717f5012d375d12af76305bb5 on apache:develop**.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] coveralls edited a comment on pull request #3235: Use constants or objects with specific values to call equals

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3235:
URL: https://github.com/apache/rocketmq/pull/3235#issuecomment-894994636


   
   [![Coverage Status](https://coveralls.io/builds/42020061/badge)](https://coveralls.io/builds/42020061)
   
   Coverage increased (+0.1%) to 54.206% when pulling **67ebc460c212ccbe14673a6ace283edb2713752e on zhaohai1299002788:dev-constants-equals** into **44bdeedad2d0e28717f5012d375d12af76305bb5 on apache:develop**.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] coveralls edited a comment on pull request #3235: Use constants or objects with specific values to call equals

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #3235:
URL: https://github.com/apache/rocketmq/pull/3235#issuecomment-894994636


   
   [![Coverage Status](https://coveralls.io/builds/41989577/badge)](https://coveralls.io/builds/41989577)
   
   Coverage increased (+0.02%) to 54.115% when pulling **cc71184ba34e6920207c68bdbf29be5f3cb9a490 on zhaohai1299002788:dev-constants-equals** into **44bdeedad2d0e28717f5012d375d12af76305bb5 on apache:develop**.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org