[GitHub] xubo245 commented on a change in pull request #3116: [CARBONDATA-3229]Validate the true/false for all boolean parameters

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] xubo245 commented on a change in pull request #3116: [CARBONDATA-3229]Validate the true/false for all boolean parameters

GitBox
xubo245 commented on a change in pull request #3116: [CARBONDATA-3229]Validate the true/false for all boolean parameters
URL: https://github.com/apache/carbondata/pull/3116#discussion_r252086157
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
 ##########
 @@ -1585,4 +1642,26 @@ private void validateDetailQueryBatchSize() {
       }
     }
   }
+
+  /**
+   * This method validates the Boolean type property. If some invalid input is set, we use the
+   * default value for this property
+   */
+  private void validateBooleanProperty(String key) {
+    if (!CarbonUtil.validateBoolean(carbonProperties.getProperty(key))) {
+      carbonProperties.setProperty(key, booleanProperties.get(key));
+    }
+  }
+
+  /**
+   * This method validates the Boolean type properties. If some invalid input is set, we use the
+   * default value for this property
+   */
+  private void validateBooleanProperties() {
+    for (Map.Entry<String, String> property: booleanProperties.entrySet()) {
+      if (!CarbonUtil.validateBoolean(carbonProperties.getProperty(property.getKey()))) {
 
 Review comment:
   Can you invoke validateBooleanProperty instead write some duplicate code in here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services