Skip to content

Commit 5947657

Browse files
authored
Replace gRPC Status#equals() with Status#isOk(). Status#equals() uses reference equality. Status#isOk() or comparing Status#getCode() is preferred. (firebase#2436)
1 parent a493044 commit 5947657

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/AbstractStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public void start() {
273273
private void close(State finalState, Status status) {
274274
hardAssert(isStarted(), "Only started streams should be closed.");
275275
hardAssert(
276-
finalState == State.Error || status.equals(Status.OK),
276+
finalState == State.Error || status.isOk(),
277277
"Can't provide an error when not in an error state.");
278278
workerQueue.verifyIsCurrentThread();
279279

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ private void handleWatchChange(SnapshotVersion snapshotVersion, WatchChange watc
468468
}
469469

470470
private void handleWatchStreamClose(Status status) {
471-
if (Status.OK.equals(status)) {
471+
if (status.isOk()) {
472472
// Graceful stop (due to stop() or idle timeout). Make sure that's desirable.
473473
hardAssert(
474474
!shouldStartWatchStream(), "Watch stream was stopped gracefully while still needed.");
@@ -655,7 +655,7 @@ private void handleWriteStreamMutationResults(
655655
}
656656

657657
private void handleWriteStreamClose(Status status) {
658-
if (Status.OK.equals(status)) {
658+
if (status.isOk()) {
659659
// Graceful stop (due to stop() or idle timeout). Make sure that's desirable.
660660
hardAssert(
661661
!shouldStartWriteStream(), "Write stream was stopped gracefully while still needed.");

0 commit comments

Comments
 (0)