chia7712 commented on code in PR #15823:
URL: https://github.com/apache/kafka/pull/15823#discussion_r1582290331


##########
clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java:
##########
@@ -392,14 +392,14 @@ private String 
topicPartitionsToLogString(Collection<TopicPartition> partitions)
         if (!log.isTraceEnabled()) {
             return String.format("%d partition(s)", partitions.size());
         }
-        return "(" + Utils.join(partitions, ", ") + ")";
+        return "(" + String.join(", ", Arrays.toString(partitions.toArray())) 
+ ")";

Review Comment:
   ditto



##########
clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java:
##########
@@ -392,14 +392,14 @@ private String 
topicPartitionsToLogString(Collection<TopicPartition> partitions)
         if (!log.isTraceEnabled()) {
             return String.format("%d partition(s)", partitions.size());
         }
-        return "(" + Utils.join(partitions, ", ") + ")";
+        return "(" + String.join(", ", Arrays.toString(partitions.toArray())) 
+ ")";
     }
 
     private String topicIdPartitionsToLogString(Collection<TopicIdPartition> 
partitions) {
         if (!log.isTraceEnabled()) {
             return String.format("%d partition(s)", partitions.size());
         }
-        return "(" + Utils.join(partitions, ", ") + ")";
+        return "(" + String.join(", ", Arrays.toString(partitions.toArray())) 
+ ")";

Review Comment:
   ditto



##########
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##########
@@ -584,27 +584,6 @@ public static String formatBytes(long bytes) {
         }
     }
 
-    /**
-     * Create a string representation of an array joined by the given separator
-     * @param strs The array of items
-     * @param separator The separator
-     * @return The string representation.
-     */
-    public static <T> String join(T[] strs, String separator) {
-        return join(Arrays.asList(strs), separator);
-    }
-
-    /**
-     * Create a string representation of a collection joined by the given 
separator
-     * @param collection The list of items
-     * @param separator The separator
-     * @return The string representation.
-     */
-    public static <T> String join(Collection<T> collection, String separator) {
-        Objects.requireNonNull(collection);
-        return mkString(collection.stream(), "", "", separator);
-    }
-
     /**
      * Create a string representation of a stream surrounded by `begin` and 
`end` and joined by `separator`.
      *

Review Comment:
   It seems `mkString(Stream<T> stream, String begin, String end, String 
separator)` can be removed too since the only one use case 
(https://github.com/apache/kafka/blob/5de5d967adffd864bad3ec729760a430253abf38/tools/src/test/java/org/apache/kafka/tools/consumer/group/ConsumerGroupServiceTest.java#L199)
 does not use "begin" and "end"



##########
clients/src/main/java/org/apache/kafka/clients/CommonClientConfigs.java:
##########
@@ -131,7 +130,7 @@ public class CommonClientConfigs {
 
     public static final String SECURITY_PROTOCOL_CONFIG = "security.protocol";
     public static final String SECURITY_PROTOCOL_DOC = "Protocol used to 
communicate with brokers. Valid values are: " +
-        Utils.join(SecurityProtocol.names(), ", ") + ".";
+        String.join(", ", SecurityProtocol.names()).replace("[", 
"").replace("]", "") + ".";

Review Comment:
   please don't use `replace`. We can generate the correct message at once.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to