Skip to content

Commit 467e6a0

Browse files
---
yaml --- r: 8813 b: refs/heads/lesv-patch-1 c: 8dad469 h: refs/heads/master i: 8811: fc97a4d
1 parent f3e201b commit 467e6a0

4 files changed

Lines changed: 13 additions & 1 deletion

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ refs/tags/v0.22.0: 18b298fe4bfe8ec2f20b0e0bf7ffdcce5cc3c5fe
6666
refs/heads/vam-google-patch-1: d0c8fee3a4074d0bf7360ce8c4f7f7223d0ee7b9
6767
refs/heads/vam-google-patch-CODEOWNERS: 2ac1616e25229e51d08a984708ef1918f91a35ee
6868
refs/heads/danoscarmike-patch-1: 7342a9916bce4ed00002c7202e2a16c5d46afaea
69-
refs/heads/lesv-patch-1: e30b794e2d5549c3cff944494dec95320455e2f2
69+
refs/heads/lesv-patch-1: 8dad46922b01428b84f0f7a7cc036573fc4b8942
7070
refs/heads/ml-update-branch: 079dd6610017f5c51b9d1938c12d6d55b61513cf
7171
refs/heads/vkedia-patch-2: 7d8241388a9769a5c069334761b06c7012c878e7
7272
refs/heads/vkedia-patch-3: 4d128043acaa7db9160faf439d2ca6104e8a88cb

branches/lesv-patch-1/google-cloud-firestore/src/main/java/com/google/cloud/firestore/BasePath.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.firestore;
1818

19+
import com.google.common.base.Preconditions;
1920
import com.google.common.collect.ImmutableList;
2021
import javax.annotation.Nullable;
2122

@@ -52,6 +53,7 @@ B getParent() {
5253
* @param path A relative path
5354
*/
5455
B append(String path) {
56+
Preconditions.checkArgument(path != null && !path.isEmpty(), "'path' must be a non-empty String" );
5557
ImmutableList.Builder<String> components = ImmutableList.builder();
5658
components.addAll(this.getSegments());
5759
components.add(splitChildPath(path));

branches/lesv-patch-1/google-cloud-firestore/src/test/java/com/google/cloud/firestore/CollectionReferenceTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
import static org.junit.Assert.assertEquals;
2020
import static org.junit.Assert.assertNull;
2121
import static org.junit.Assert.assertTrue;
22+
import static org.junit.Assert.fail;
2223
import static org.mockito.Mockito.doReturn;
2324

2425
import com.google.api.core.ApiFuture;
2526
import com.google.api.gax.rpc.UnaryCallable;
27+
import com.google.cloud.firestore.Transaction.Function;
2628
import com.google.cloud.firestore.spi.v1beta1.FirestoreRpc;
2729
import com.google.firestore.v1beta1.CommitRequest;
2830
import com.google.firestore.v1beta1.CommitResponse;
@@ -68,6 +70,13 @@ public void getDocument() {
6870
assertEquals("doc", documentReference.getId());
6971
documentReference = collectionReference.document();
7072
assertEquals(20, documentReference.getId().length());
73+
74+
try {
75+
collectionReference.document("");
76+
fail();
77+
} catch (IllegalArgumentException e) {
78+
assertTrue(e.getMessage().endsWith("'path' must be a non-empty String"));
79+
}
7180
}
7281

7382
@Test

branches/lesv-patch-1/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITSystemTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ public String updateCallback(Transaction transaction) {
423423
}
424424
})
425425
.get();
426+
fail();
426427
} catch (Exception e) {
427428
assertTrue(e.getMessage().endsWith("User exception"));
428429
}

0 commit comments

Comments
 (0)