You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/11/17 12:42:23 UTC

[GitHub] [pulsar] RobertIndie commented on a change in pull request #12837: Remove werid assign value in DefaultMessageFormatter

RobertIndie commented on a change in pull request #12837:
URL: https://github.com/apache/pulsar/pull/12837#discussion_r751201923



##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/DefaultMessageFormatter.java
##########
@@ -81,21 +81,18 @@ private float _getFloatValue(float size) {
 
     private String getStringValue(float size) {
         int s = (int) size;
-        if (size == 0) {

Review comment:
       It seems that the `size` is not used later. It looks like the intent of this method is to generate the random string of default size 20 when 0 is passed in. I think the value here should be assigned to the `s` instead of the `size`.

##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/DefaultMessageFormatter.java
##########
@@ -81,21 +81,18 @@ private float _getFloatValue(float size) {
 
     private String getStringValue(float size) {
         int s = (int) size;
-        if (size == 0) {
-            size = 20;
-        };
-        String result = "";
+        StringBuilder result = new StringBuilder();
         for(int i = 0; i < s; i++) {

Review comment:
       I agree.




-- 
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@pulsar.apache.org

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