Skip to content

Commit de6b982

Browse files
authored
Move check in FirebaseUserManager.updateTenant outside CallableOperation. (#431)
1 parent cb4d32f commit de6b982

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/main/java/com/google/firebase/auth/FirebaseUserManager.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,6 @@ Tenant createTenant(Tenant.CreateRequest request) throws FirebaseAuthException {
254254

255255
Tenant updateTenant(Tenant.UpdateRequest request) throws FirebaseAuthException {
256256
Map<String, Object> properties = request.getProperties();
257-
// TODO(micahstairs): Move this check so that argument validation happens outside the
258-
// CallableOperation.
259-
checkArgument(!properties.isEmpty(), "tenant update must have at least one property set");
260257
GenericUrl url = new GenericUrl(tenantMgtBaseUrl + getTenantUrlSuffix(request.getTenantId()));
261258
url.put("updateMask", Joiner.on(",").join(generateMask(properties)));
262259
return sendRequest("PATCH", url, properties, Tenant.class);

src/main/java/com/google/firebase/auth/TenantManager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public Tenant getTenant(@NonNull String tenantId) throws FirebaseAuthException {
6868
}
6969

7070
public synchronized TenantAwareFirebaseAuth getAuthForTenant(@NonNull String tenantId) {
71-
checkArgument(!Strings.isNullOrEmpty(tenantId), "tenantId must not be null or empty");
71+
checkArgument(!Strings.isNullOrEmpty(tenantId), "Tenant ID must not be null or empty.");
7272
if (!tenantAwareAuths.containsKey(tenantId)) {
7373
tenantAwareAuths.put(tenantId, new TenantAwareFirebaseAuth(firebaseApp, tenantId));
7474
}
@@ -90,7 +90,7 @@ public ApiFuture<Tenant> getTenantAsync(@NonNull String tenantId) {
9090

9191
private CallableOperation<Tenant, FirebaseAuthException> getTenantOp(final String tenantId) {
9292
checkNotDestroyed();
93-
checkArgument(!Strings.isNullOrEmpty(tenantId), "tenantId must not be null or empty");
93+
checkArgument(!Strings.isNullOrEmpty(tenantId), "Tenant ID must not be null or empty.");
9494
return new CallableOperation<Tenant, FirebaseAuthException>() {
9595
@Override
9696
protected Tenant execute() throws FirebaseAuthException {
@@ -196,7 +196,7 @@ public ApiFuture<Tenant> createTenantAsync(@NonNull CreateRequest request) {
196196
private CallableOperation<Tenant, FirebaseAuthException> createTenantOp(
197197
final CreateRequest request) {
198198
checkNotDestroyed();
199-
checkNotNull(request, "create request must not be null");
199+
checkNotNull(request, "Create request must not be null.");
200200
return new CallableOperation<Tenant, FirebaseAuthException>() {
201201
@Override
202202
protected Tenant execute() throws FirebaseAuthException {
@@ -234,7 +234,9 @@ public ApiFuture<Tenant> updateTenantAsync(@NonNull UpdateRequest request) {
234234
private CallableOperation<Tenant, FirebaseAuthException> updateTenantOp(
235235
final UpdateRequest request) {
236236
checkNotDestroyed();
237-
checkNotNull(request, "update request must not be null");
237+
checkNotNull(request, "Update request must not be null.");
238+
checkArgument(!request.getProperties().isEmpty(),
239+
"Tenant update must have at least one property set.");
238240
return new CallableOperation<Tenant, FirebaseAuthException>() {
239241
@Override
240242
protected Tenant execute() throws FirebaseAuthException {
@@ -269,7 +271,7 @@ public ApiFuture<Void> deleteTenantAsync(String tenantId) {
269271

270272
private CallableOperation<Void, FirebaseAuthException> deleteTenantOp(final String tenantId) {
271273
checkNotDestroyed();
272-
checkArgument(!Strings.isNullOrEmpty(tenantId), "tenantId must not be null or empty");
274+
checkArgument(!Strings.isNullOrEmpty(tenantId), "Tenant ID must not be null or empty.");
273275
return new CallableOperation<Void, FirebaseAuthException>() {
274276
@Override
275277
protected Void execute() throws FirebaseAuthException {

0 commit comments

Comments
 (0)