Commit a3c50b4b authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed NPE on Cancel in Verifier dialog

parent 457b7ea7
...@@ -243,9 +243,11 @@ public class SettingsDialog extends Dialog { ...@@ -243,9 +243,11 @@ public class SettingsDialog extends Dialog {
_log.warn(e.getMessage()); _log.warn(e.getMessage());
String authorizationUrl = genesysClient.getAuthorizationUrl(null); String authorizationUrl = genesysClient.getAuthorizationUrl(null);
VerifierDialog vd = new VerifierDialog(getParent(), SWT.NONE); VerifierDialog vd = new VerifierDialog(getParent(), SWT.NONE);
String verifierCode = vd.open(authorizationUrl).trim(); String verifierCode = vd.open(authorizationUrl);
_log.info("Got verifier code: " + verifierCode);
if (StringUtils.isNotBlank(verifierCode)) { if (StringUtils.isNotBlank(verifierCode)) {
verifierCode = verifierCode.trim();
_log.info("Got verifier code: " + verifierCode);
try { try {
genesysClient.authenticate(verifierCode); genesysClient.authenticate(verifierCode);
oauthSettings.setAccessToken(genesysClient.getAccessToken().getToken()); oauthSettings.setAccessToken(genesysClient.getAccessToken().getToken());
...@@ -257,11 +259,8 @@ public class SettingsDialog extends Dialog { ...@@ -257,11 +259,8 @@ public class SettingsDialog extends Dialog {
} }
} catch (HttpRedirectException e) { } catch (HttpRedirectException e) {
_log.error(e.getMessage(), e); _log.error(e.getMessage(), e);
SwtUtil.showMessageBox( SwtUtil.showMessageBox(getParent(), "Server redirect",
getParent(), "Server is redirecting to a different URL. Check your Genesys Server URL!\n\n" + e.getRedirectUrl());
"Server redirect",
"Server is redirecting to a different URL. Check your Genesys Server URL!\n\n"
+ e.getRedirectUrl());
} catch (PleaseRetryException e) { } catch (PleaseRetryException e) {
_log.error("Please retry", e); _log.error("Please retry", e);
} catch (GenesysApiException e) { } catch (GenesysApiException e) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment