Skip to content

Commit

Permalink
fix NullPointerException in refactored code
Browse files Browse the repository at this point in the history
at com.zimbra.oauth.token.handlers.impl.NextCloudTokenHandler.refreshAccessToken(NextCloudTokenHandler.java:84)

Update NextCloudTokenHandler.java
  • Loading branch information
Barry de Graaff authored and jrjena136 committed Sep 10, 2020
1 parent 73884d4 commit 82c05d9
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ public static String refreshAccessToken(Account acct, String client) throws Serv
String redirecUri = value.substring(0, value.lastIndexOf(":"));
final String clientRedirectUri = redirecUri;

value = LdapOauthHelper.getFirstConfig(Provisioning.A_zimbraOAuthConsumerAPIScope,client, acct);
String nextCloudUrl =value.substring(0, value.lastIndexOf(":"));
String nextCloudUrl = null;
value = LdapOauthHelper.getFirstConfig(Provisioning.A_zimbraOAuthConsumerAPIScope, client + "_noop", acct);
try {
nextCloudUrl = value.substring(0, value.lastIndexOf(":"));
} catch (Exception e) {
throw ServiceException.FAILURE("Failed to get nextCloudUrl from zimbraOAuthConsumerAPIScope", null);
}

if (StringUtil.isNullOrEmpty(clientId) || StringUtil.isNullOrEmpty(clientSecret)
|| StringUtil.isNullOrEmpty(clientRedirectUri)) {
Expand Down

0 comments on commit 82c05d9

Please sign in to comment.