Skip to content

Commit

Permalink
Catch null error in key vault
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu committed Apr 14, 2017
1 parent 222ff34 commit bc39915
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.microsoft.azure.management.keyvault.implementation;

import com.microsoft.azure.CloudException;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.graphrbac.ServicePrincipal;
import com.microsoft.azure.management.graphrbac.User;
Expand Down Expand Up @@ -206,6 +207,10 @@ private Observable<List<AccessPolicy>> populateAccessPolicies() {
.doOnNext(new Action1<User>() {
@Override
public void call(User user) {
if (user == null) {
throw new CloudException(String.format("User principal name %s is not found in tenant %s",
accessPolicy.userPrincipalName(), graphRbacManager.tenantId()), null);
}
accessPolicy.forObjectId(user.objectId());
}
}));
Expand All @@ -215,6 +220,10 @@ public void call(User user) {
.doOnNext(new Action1<ServicePrincipal>() {
@Override
public void call(ServicePrincipal sp) {
if (sp == null) {
throw new CloudException(String.format("User principal name %s is not found in tenant %s",
accessPolicy.userPrincipalName(), graphRbacManager.tenantId()), null);
}
accessPolicy.forObjectId(sp.objectId());
}
}));
Expand Down

0 comments on commit bc39915

Please sign in to comment.