chia7712 commented on code in PR #15507: URL: https://github.com/apache/kafka/pull/15507#discussion_r1525419354
########## server-common/src/main/java/org/apache/kafka/server/mutable/BoundedList.java: ########## @@ -40,18 +40,17 @@ public static <E> BoundedList<E> newArrayBacked(int maxLength) { } public static <E> BoundedList<E> newArrayBacked(int maxLength, int initialCapacity) { + if (initialCapacity <= 0) { + throw new IllegalArgumentException("Invalid non-positive initialCapacity of " + initialCapacity); + } return new BoundedList<>(maxLength, new ArrayList<>(initialCapacity)); } - public BoundedList(int maxLength, List<E> underlying) { + private BoundedList(int maxLength, List<E> underlying) { if (maxLength <= 0) { throw new IllegalArgumentException("Invalid non-positive maxLength of " + maxLength); } this.maxLength = maxLength; - if (underlying.size() > maxLength) { Review Comment: this check is still useful to me since all helpers are based on this constructor, and so it is a good safety catch. ########## server-common/src/main/java/org/apache/kafka/server/mutable/BoundedList.java: ########## @@ -40,18 +40,17 @@ public static <E> BoundedList<E> newArrayBacked(int maxLength) { } public static <E> BoundedList<E> newArrayBacked(int maxLength, int initialCapacity) { + if (initialCapacity <= 0) { Review Comment: nice check! ########## metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java: ########## @@ -172,8 +172,7 @@ ControllerResult<Map<ConfigResource, ApiError>> incrementalAlterConfigs( Map<ConfigResource, Map<String, Entry<OpType, String>>> configChanges, boolean newlyCreatedResource ) { - List<ApiMessageAndVersion> outputRecords = Review Comment: Could you please revert those changes? the simpler the better :) -- 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