Fixed NPE in API publisher client (#882)

This commit is contained in:
Milan Perera 2017-08-04 09:33:37 +05:30 committed by Madhawa Perera
parent 7abc9e5844
commit 25840a1279
2 changed files with 5 additions and 1 deletions

View File

@ -101,6 +101,10 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
REQUIRED_SCOPE);
tenantBasedAccessTokenInfo.setExpiresIn(
System.currentTimeMillis() + (tenantBasedAccessTokenInfo.getExpiresIn() * 1000));
if (tenantBasedAccessTokenInfo.getScopes() == null) {
throw new APIMClientOAuthException("Failed to retrieve scopes from access token");
}
if (tenantBasedAccessTokenInfo.getScopes().contains(APIM_SUBSCRIBE_SCOPE)) {
tenantUserTokenMap.put(username, tenantBasedAccessTokenInfo);
}

View File

@ -35,7 +35,7 @@ public class APIMClientOAuthException extends RuntimeException {
this.responseStatus = status;
}
APIMClientOAuthException(String message) {
public APIMClientOAuthException(String message) {
super(message);
}