ebyhr commented on code in PR #18595:
URL: https://github.com/apache/iceberg/pull/18595#discussion_r4548030274
##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkConfig.java:
##########
@@ -404,11 +403,14 @@ public TableSinkConfig tableConfig(String tableName) {
@VisibleForTesting
static List<String> stringToList(String value, String regex) {
- if (value == null || value.isEmpty()) {
+ if (value == null || value.trim().isEmpty()) {
return ImmutableList.of();
}
- return
Arrays.stream(value.split(regex)).map(String::trim).collect(Collectors.toList());
+ return Arrays.stream(value.split(regex))
+ .map(String::trim)
+ .filter(string -> !string.isEmpty())
+ .toList();
}
Review Comment:
We could simplify with `Splitter`:
```java
static List<String> stringToList(String value, String regex) {
if (value == null) {
return ImmutableList.of();
}
return
Splitter.onPattern(regex).omitEmptyStrings().trimResults().splitToList(value);
}
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]