You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/12/15 08:05:49 UTC

[GitHub] [rocketmq] xiaoyifang opened a new pull request, #5700: [ISSUE #5699] remove duplicate code definition of UtilAll.isBlank

xiaoyifang opened a new pull request, #5700:
URL: https://github.com/apache/rocketmq/pull/5700

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   fix #5699 
   
   ## Brief changelog
   
   XX
   
   ## Verifying this change
   
   XXXX
   
   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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] xiaoyifang commented on a diff in pull request #5700: [ISSUE #5699] remove duplicate code definition of UtilAll.isBlank

Posted by GitBox <gi...@apache.org>.
xiaoyifang commented on code in PR #5700:
URL: https://github.com/apache/rocketmq/pull/5700#discussion_r1049332071


##########
remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:
##########
@@ -243,15 +245,6 @@ public static HashMap<String, String> mapDeserialize(ByteBuf byteBuffer, int len
     }
 
     public static boolean isBlank(String str) {
-        int strLen;
-        if (str == null || (strLen = str.length()) == 0) {
-            return true;
-        }
-        for (int i = 0; i < strLen; i++) {
-            if (!Character.isWhitespace(str.charAt(i))) {
-                return false;
-            }
-        }
-        return true;
+        return StringUtils.isBlank(str);

Review Comment:
   ![image](https://user-images.githubusercontent.com/105986/207807717-e1ced284-fbf5-48cb-b0a3-a26b7025c62e.png)
   
   I think this can be done ,this very method is only used in test



-- 
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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] xiaoyifang commented on a diff in pull request #5700: [ISSUE #5699] remove duplicate code definition of UtilAll.isBlank

Posted by GitBox <gi...@apache.org>.
xiaoyifang commented on code in PR #5700:
URL: https://github.com/apache/rocketmq/pull/5700#discussion_r1049335133


##########
remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:
##########
@@ -243,15 +245,6 @@ public static HashMap<String, String> mapDeserialize(ByteBuf byteBuffer, int len
     }
 
     public static boolean isBlank(String str) {
-        int strLen;
-        if (str == null || (strLen = str.length()) == 0) {
-            return true;
-        }
-        for (int i = 0; i < strLen; i++) {
-            if (!Character.isWhitespace(str.charAt(i))) {
-                return false;
-            }
-        }
-        return true;
+        return StringUtils.isBlank(str);

Review Comment:
   fixed



-- 
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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] RongtongJin commented on a diff in pull request #5700: [ISSUE #5699] remove duplicate code definition of UtilAll.isBlank

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #5700:
URL: https://github.com/apache/rocketmq/pull/5700#discussion_r1049328387


##########
common/src/main/java/org/apache/rocketmq/common/UtilAll.java:
##########
@@ -462,16 +463,7 @@ public static String frontStringAtLeast(final String str, final int size) {
     }
 
     public static boolean isBlank(String str) {

Review Comment:
   How to delete this method and replace all with StringUtils.isBlank?



##########
remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:
##########
@@ -243,15 +245,6 @@ public static HashMap<String, String> mapDeserialize(ByteBuf byteBuffer, int len
     }
 
     public static boolean isBlank(String str) {
-        int strLen;
-        if (str == null || (strLen = str.length()) == 0) {
-            return true;
-        }
-        for (int i = 0; i < strLen; i++) {
-            if (!Character.isWhitespace(str.charAt(i))) {
-                return false;
-            }
-        }
-        return true;
+        return StringUtils.isBlank(str);

Review Comment:
   How to delete this method and replace all with StringUtils.isBlank?



-- 
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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] xiaoyifang commented on a diff in pull request #5700: [ISSUE #5699] remove duplicate code definition of UtilAll.isBlank

Posted by GitBox <gi...@apache.org>.
xiaoyifang commented on code in PR #5700:
URL: https://github.com/apache/rocketmq/pull/5700#discussion_r1049336834


##########
common/src/main/java/org/apache/rocketmq/common/UtilAll.java:
##########
@@ -462,16 +463,7 @@ public static String frontStringAtLeast(final String str, final int size) {
     }
 
     public static boolean isBlank(String str) {

Review Comment:
   Let's keep this UtilAll.isBlank , for there are more than 31 places using this method.
   
   The current fix will keep the changes line at the minimum.



-- 
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: commits-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] lizhanhui merged pull request #5700: [ISSUE #5699] remove duplicate code definition of UtilAll.isBlank

Posted by GitBox <gi...@apache.org>.
lizhanhui merged PR #5700:
URL: https://github.com/apache/rocketmq/pull/5700


-- 
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: commits-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 #5700: [ISSUE #5699] remove duplicate code definition of UtilAll.isBlank

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

   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/5700?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 [#5700](https://codecov.io/gh/apache/rocketmq/pull/5700?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c788207) into [develop](https://codecov.io/gh/apache/rocketmq/commit/aa7a442505ac012d1bc61b89bf10c41646a15005?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (aa7a442) will **decrease** coverage by `0.03%`.
   > The diff coverage is `66.66%`.
   
   > :exclamation: Current head c788207 differs from pull request most recent head 1193389. Consider uploading reports for the commit 1193389 to get more accurate results
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #5700      +/-   ##
   =============================================
   - Coverage      42.35%   42.32%   -0.04%     
   + Complexity      8192     8180      -12     
   =============================================
     Files           1060     1060              
     Lines          73108    73092      -16     
     Branches        9586     9580       -6     
   =============================================
   - Hits           30962    30933      -29     
   - Misses         38234    38252      +18     
   + Partials        3912     3907       -5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/5700?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...he/rocketmq/remoting/protocol/RemotingCommand.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL3Byb3RvY29sL1JlbW90aW5nQ29tbWFuZC5qYXZh) | `70.83% <0.00%> (+1.10%)` | :arrow_up: |
   | [.../main/java/org/apache/rocketmq/common/UtilAll.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vVXRpbEFsbC5qYXZh) | `36.52% <100.00%> (-0.55%)` | :arrow_down: |
   | [...cketmq/remoting/protocol/RocketMQSerializable.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL3Byb3RvY29sL1JvY2tldE1RU2VyaWFsaXphYmxlLmphdmE=) | `84.48% <100.00%> (-0.65%)` | :arrow_down: |
   | [...controller/impl/DefaultBrokerHeartbeatManager.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-Y29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvY29udHJvbGxlci9pbXBsL0RlZmF1bHRCcm9rZXJIZWFydGJlYXRNYW5hZ2VyLmphdmE=) | `74.41% <0.00%> (-3.49%)` | :arrow_down: |
   | [...e/rocketmq/store/ha/autoswitch/EpochFileCache.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL2F1dG9zd2l0Y2gvRXBvY2hGaWxlQ2FjaGUuamF2YQ==) | `78.47% <0.00%> (-2.78%)` | :arrow_down: |
   | [...mq/store/ha/autoswitch/AutoSwitchHAConnection.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL2F1dG9zd2l0Y2gvQXV0b1N3aXRjaEhBQ29ubmVjdGlvbi5qYXZh) | `70.00% <0.00%> (-2.44%)` | :arrow_down: |
   | [...impl/consumer/ConsumeMessagePopOrderlyService.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9Db25zdW1lTWVzc2FnZVBvcE9yZGVybHlTZXJ2aWNlLmphdmE=) | `10.00% <0.00%> (-2.23%)` | :arrow_down: |
   | [...nt/impl/consumer/ConsumeMessageOrderlyService.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9Db25zdW1lTWVzc2FnZU9yZGVybHlTZXJ2aWNlLmphdmE=) | `44.91% <0.00%> (-1.76%)` | :arrow_down: |
   | [...apache/rocketmq/store/ha/GroupTransferService.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL0dyb3VwVHJhbnNmZXJTZXJ2aWNlLmphdmE=) | `92.30% <0.00%> (-1.29%)` | :arrow_down: |
   | [...cketmq/broker/schedule/ScheduleMessageService.java](https://codecov.io/gh/apache/rocketmq/pull/5700/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvc2NoZWR1bGUvU2NoZWR1bGVNZXNzYWdlU2VydmljZS5qYXZh) | `56.91% <0.00%> (-1.14%)` | :arrow_down: |
   | ... and [11 more](https://codecov.io/gh/apache/rocketmq/pull/5700/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) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?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: commits-unsubscribe@rocketmq.apache.org

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