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 2022/03/07 18:23:37 UTC

[GitHub] [pulsar] JoeCqupt opened a new pull request #14586: improve FieldParser converters

JoeCqupt opened a new pull request #14586:
URL: https://github.com/apache/pulsar/pull/14586


   
   
   ### Motivation
   
   improve FieldParser converters, let them keep the same code style
   
   ### Modifications
   
   update FieldParser converters
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (yes / no)
     - The public API: (yes / no)
     - The schema: (yes / no / don't know)
     - The default values of configurations: (yes / no)
     - The wire protocol: (yes / no)
     - The rest endpoints: (yes / no)
     - The admin cli options: (yes / no)
     - Anything that affects deployment: (yes / no / don't know)
   
   ### Documentation
   
   Check the box below or label this PR directly (if you have committer privilege).
   
   Need to update docs? 
     
   - [ ] `no-need-doc` 
     
   just  code cleanup
     
   
   
   


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



[GitHub] [pulsar] github-actions[bot] commented on pull request #14586: improve FieldParser converters

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14586:
URL: https://github.com/apache/pulsar/pull/14586#issuecomment-1060992649


   @JoeCqupt:Thanks for your contribution. For this PR, do we need to update docs?
   (The [PR template contains info about doc](https://github.com/apache/pulsar/blob/master/.github/PULL_REQUEST_TEMPLATE.md#documentation), which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)


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



[GitHub] [pulsar] JoeCqupt commented on pull request #14586: improve FieldParser converters

Posted by GitBox <gi...@apache.org>.
JoeCqupt commented on pull request #14586:
URL: https://github.com/apache/pulsar/pull/14586#issuecomment-1061379878


   @Jason918 @eolivelli @merlimat  PTAL,thanks!


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



[GitHub] [pulsar] github-actions[bot] commented on pull request #14586: improve FieldParser converters

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14586:
URL: https://github.com/apache/pulsar/pull/14586#issuecomment-1061378349


   @JoeCqupt:Thanks for providing doc info!


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



[GitHub] [pulsar] codelipenghui commented on a change in pull request #14586: improve FieldParser converters

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #14586:
URL: https://github.com/apache/pulsar/pull/14586#discussion_r826536123



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/util/FieldParser.java
##########
@@ -301,7 +306,12 @@ public static Double stringToDouble(String val) {
      * @return The converted Double value.
      */
     public static Float stringToFloat(String val) {
-        return Float.valueOf(trim(val));
+        String v = trim(val);
+        if (io.netty.util.internal.StringUtil.isNullOrEmpty(v)) {

Review comment:
       ```suggestion
           if (StringUtils.isEmpty(v)) {
   ```

##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/util/FieldParser.java
##########
@@ -274,7 +274,12 @@ public static Integer stringToInteger(String val) {
      * @return The converted Long value.
      */
     public static Long stringToLong(String val) {
-        return Long.valueOf(trim(val));
+        String v = trim(val);
+        if (io.netty.util.internal.StringUtil.isNullOrEmpty(v)) {

Review comment:
       ```suggestion
           if (StringUtils.isEmpty(v)) {
   ```

##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/util/FieldParser.java
##########
@@ -384,7 +394,12 @@ public static String booleanToString(Boolean value) {
      * @return The converted Boolean value.
      */
     public static Boolean stringToBoolean(String value) {
-        return Boolean.valueOf(value);
+        String v = trim(value);
+        if (io.netty.util.internal.StringUtil.isNullOrEmpty(v)) {

Review comment:
       ```suggestion
           if (StringUtils.isEmpty(v)) {
   ```




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