Copilot commented on code in PR #25289:
URL: https://github.com/apache/pulsar/pull/25289#discussion_r2903811731
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarChannelInitializer.java:
##########
@@ -106,10 +106,14 @@ public void initChannel(SocketChannel ch) throws
Exception {
* @return a {@link CompletableFuture} that completes when the TLS is set
up.
*/
CompletableFuture<Channel> initTls(Channel ch, InetSocketAddress sniHost) {
- Objects.requireNonNull(ch, "A channel is required");
- Objects.requireNonNull(sniHost, "A sniHost is required");
+ if (ch == null) {
+ return FutureUtil.failedFuture(new NullPointerException("A channel
is required"));
+ }
+ if (sniHost == null) {
+ return FutureUtil.failedFuture(new NullPointerException("A sniHost
is required"));
+ }
if (!tlsEnabled) {
- throw new IllegalStateException("TLS is not enabled in client
configuration");
+ return FutureUtil.failedFuture(new IllegalStateException("TLS is
not enabled in client configuration"));
}
Review Comment:
PR title scopes this as "[broker]", but this change also modifies
client/common/managed-ledger code paths (e.g.,
`PulsarChannelInitializer#initTls`). Consider updating the PR title/description
(or splitting) so the scope matches the actual changes, which helps reviewers
and release notes.
##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/FutureUtil.java:
##########
@@ -228,10 +227,13 @@ public static <T> Sequencer<T> create() {
}
/**
- * @throws NullPointerException NPE when param is null
+ * @return a {@link CompletableFuture} representing the newly
scheduled task,
+ * or a completed exceptionally with {@link NullPointerException} if
param is null.
Review Comment:
Javadoc grammar: "or a completed exceptionally" is ungrammatical; consider
rephrasing to something like "or one completed exceptionally" to make the
sentence read correctly.
```suggestion
* or one completed exceptionally with {@link NullPointerException}
if param is null.
```
--
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]