diff --git a/google-cloud-firestore/pom.xml b/google-cloud-firestore/pom.xml index 49617e17bc..02e7c5aca4 100644 --- a/google-cloud-firestore/pom.xml +++ b/google-cloud-firestore/pom.xml @@ -158,7 +158,7 @@ com.google.cloud google-cloud-conformance-tests - 0.3.6 + 0.3.7 test diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Precondition.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Precondition.java index 54b55b8188..fb8be8778c 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Precondition.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Precondition.java @@ -62,8 +62,8 @@ boolean isEmpty() { return exists == null && updateTime == null; } - boolean hasExists() { - return exists != null; + Boolean getExists() { + return exists; } com.google.firestore.v1.Precondition toPb() { diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java index 4336e255ce..a9326a8fc4 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java @@ -387,7 +387,8 @@ public T update( @Nonnull Map fields, Precondition precondition) { Preconditions.checkArgument( - !precondition.hasExists(), "Precondition 'exists' cannot be specified for update() calls."); + !Boolean.FALSE.equals(precondition.getExists()), + "Precondition 'exists' cannot have the value 'false' for update() calls."); return performUpdate( documentReference, convertToFieldPaths(fields, /* splitOnDots= */ true), precondition); } @@ -455,7 +456,8 @@ public T update( @Nullable Object value, Object... moreFieldsAndValues) { Preconditions.checkArgument( - !precondition.hasExists(), "Precondition 'exists' cannot be specified for update() calls."); + !Boolean.FALSE.equals(precondition.getExists()), + "Precondition 'exists' cannot have the value 'false' for update() calls."); return performUpdate( documentReference, precondition, @@ -483,7 +485,8 @@ public T update( @Nullable Object value, Object... moreFieldsAndValues) { Preconditions.checkArgument( - !precondition.hasExists(), "Precondition 'exists' cannot be specified for update() calls."); + !Boolean.FALSE.equals(precondition.getExists()), + "Precondition 'exists' cannot have the value 'false' for update() calls."); return performUpdate(documentReference, precondition, fieldPath, value, moreFieldsAndValues); }