Abyss-lord commented on code in PR #8442:
URL: https://github.com/apache/gravitino/pull/8442#discussion_r2323936878


##########
clients/cli/src/main/java/org/apache/gravitino/cli/Properties.java:
##########
@@ -45,8 +46,8 @@ public Properties() {
    * @param keyValueSeparator The separator used to distinguish keys from 
values in each pair.
    */
   public Properties(String delimiter, String keyValueSeparator) {
-    this.delimiter = delimiter;
-    this.keyValueSeparator = keyValueSeparator;
+    this.delimiter = Pattern.quote(delimiter);
+    this.keyValueSeparator = Pattern.quote(keyValueSeparator);
   }

Review Comment:
   I think it would be better to add checks for null arguments and empty 
strings. Also, since we’re using Pattern, it makes more sense to define a 
Pattern argument directly instead of a raw string. For example, the code could 
look like this, WDYT
   ```java
   public Properties(String delimiter, String keyValueSeparator) {
       Preconditions.checkArgument(
           delimiter != null && !delimiter.isEmpty(), "Delimiter cannot be null 
or empty");
       Preconditions.checkArgument(
           keyValueSeparator != null && !keyValueSeparator.isEmpty(),
           "Key-value separator cannot be null or empty");
       this.delimiterPattern = Pattern.compile(Pattern.quote(delimiter));
       this.keyValueSeparatorPattern = 
Pattern.compile(Pattern.quote(keyValueSeparator));
     }
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to