Abyss-lord commented on code in PR #8442:
URL: https://github.com/apache/gravitino/pull/8442#discussion_r2323938016
##########
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:
meanwhile, I think `parse` method should refactor like follows:
```java
public Map<String, String> parse(String[] inputs) {
HashMap<String, String> map = new HashMap<>();
if (inputs != null) {
for (String input : inputs) {
if (input == null || input.isEmpty()) {
continue;
}
// Split the input by the delimiter into key-value pairs
String[] pairs = delimiterPattern.split(input);
for (String pair : pairs) {
if (pair.isEmpty()) {
continue;
}
String[] keyValue = keyValueSeparatorPattern.split(pair, 2);
if (keyValue.length == 2) {
map.put(keyValue[0].trim(), keyValue[1].trim());
}
}
}
}
return map;
}
```
--
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]