Skip to content

Commit f0ff867

Browse files
authored
Merge pull request #57 from psytester/patch-1
Avoid NPE in OAuth updateAccessToken()
2 parents 494d6b1 + b9c5696 commit f0ff867

File tree

1 file changed

+6
-0
lines changed
  • src/main/java/com/docusign/esign/client/auth

1 file changed

+6
-0
lines changed

src/main/java/com/docusign/esign/client/auth/OAuth.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ public synchronized void updateAccessToken() {
8585
throw new ClientHandlerException(e.getMessage(), e);
8686
}
8787
if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) {
88+
if (accessTokenResponse.getAccessToken() == null) {
89+
throw new ClientHandlerException("Error while requesting an access token. No 'access_token' found.");
90+
}
91+
if (accessTokenResponse.getExpiresIn() == null) {
92+
throw new ClientHandlerException("Error while requesting an access token. No 'expires_in' found.");
93+
}
8894
setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn());
8995
if (accessTokenListener != null) {
9096
accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken());

0 commit comments

Comments
 (0)