mirror of https://github.com/grpc/grpc-java.git
core: Log a warning in ClientCall.cancel if no detail is provided.
Resolves #2054
This commit is contained in:
parent
841c7c4bfa
commit
093ab06530
|
|
@ -328,6 +328,10 @@ final class ClientCallImpl<ReqT, RespT> extends ClientCall<ReqT, RespT>
|
|||
|
||||
@Override
|
||||
public void cancel(@Nullable String message, @Nullable Throwable cause) {
|
||||
if (message == null && cause == null) {
|
||||
cause = new CancellationException("Cancelled without a message or cause");
|
||||
log.log(Level.WARNING, "Cancelling without a message or cause is suboptimal", cause);
|
||||
}
|
||||
if (cancelCalled) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -343,12 +347,6 @@ final class ClientCallImpl<ReqT, RespT> extends ClientCall<ReqT, RespT>
|
|||
if (cause != null) {
|
||||
status = status.withCause(cause);
|
||||
}
|
||||
if (message == null && cause == null) {
|
||||
// TODO(zhangkun83): log a warning with this exception once cancel() has been deleted from
|
||||
// ClientCall.
|
||||
status = status.withCause(
|
||||
new CancellationException("Client called cancel() without any detail"));
|
||||
}
|
||||
stream.cancel(status);
|
||||
}
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Reference in New Issue