k-raina commented on code in PR #20144: URL: https://github.com/apache/kafka/pull/20144#discussion_r2217980500
########## clients/src/main/java/org/apache/kafka/common/telemetry/internals/ClientTelemetryUtils.java: ########## @@ -181,13 +182,28 @@ public static boolean validateRequiredResourceLabels(Map<String, String> metadat return validateResourceLabel(metadata, MetricsContext.NAMESPACE); } - public static CompressionType preferredCompressionType(List<CompressionType> acceptedCompressionTypes) { - if (acceptedCompressionTypes != null && !acceptedCompressionTypes.isEmpty()) { - // Broker is providing the compression types in order of preference. Grab the - // first one. - return acceptedCompressionTypes.get(0); + /** + * Determines the preferred compression type from broker-accepted types, avoiding unsupported ones. + * + * @param acceptedCompressionTypes the list of compression types accepted by the broker in order + * of preference, or null/empty if no compression is accepted + * @param unsupportedCompressionTypes the set of compression types that should be avoided due to + * missing libraries or previous failures (must not be null) + * @return the preferred compression type to use, or {@link CompressionType#NONE} if no acceptable + * compression type is available + * @throws NullPointerException if unsupportedCompressionTypes is null + */ + public static CompressionType preferredCompressionType(List<CompressionType> acceptedCompressionTypes, Set<CompressionType> unsupportedCompressionTypes) { + if (acceptedCompressionTypes == null) { Review Comment: Thanks @chia7712 , Addressed feedback in commit https://github.com/apache/kafka/pull/20144/commits/5b18a96da77b5baa8bcc72eff1d8e254af6c565a -- 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