Skip to content

Commit

Permalink
core: revert warning about Status.asException(null)
Browse files Browse the repository at this point in the history
There seem to be some users converting from StatusRuntimeException
to StatusException using the following paradigm:

sre.getStatus().toException(sre.getTrailers())

Since there isn't a viable alternative, revert the warning.
  • Loading branch information
carl-mastrangelo authored Aug 6, 2018
1 parent 52a7b62 commit 6735208
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions core/src/main/java/io/grpc/Status.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.Collections;
import java.util.List;
import java.util.TreeMap;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;

Expand All @@ -53,8 +52,6 @@
@Immutable
public final class Status {

private static final Logger logger = Logger.getLogger(Status.class.getName());

/**
* The set of canonical status codes. If new codes are added over time they must choose
* a numerical value that does not collide with any previously used value.
Expand Down Expand Up @@ -525,10 +522,7 @@ public StatusRuntimeException asRuntimeException() {
* exception.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4683")
public StatusRuntimeException asRuntimeException(Metadata trailers) {
if (trailers == null) {
logger.warning("trailers cannot be null, this will become an error in gRPC 1.16");
}
public StatusRuntimeException asRuntimeException(@Nullable Metadata trailers) {
return new StatusRuntimeException(this, trailers);
}

Expand All @@ -544,10 +538,7 @@ public StatusException asException() {
* Same as {@link #asException()} but includes the provided trailers in the returned exception.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4683")
public StatusException asException(Metadata trailers) {
if (trailers == null) {
logger.warning("trailers cannot be null, this will become an error in gRPC 1.16");
}
public StatusException asException(@Nullable Metadata trailers) {
return new StatusException(this, trailers);
}

Expand Down

0 comments on commit 6735208

Please sign in to comment.