Commit a3c50b4b authored by Matija Obreza's avatar Matija Obreza

Fixed NPE on Cancel in Verifier dialog

parent 457b7ea7
......@@ -243,9 +243,11 @@ public class SettingsDialog extends Dialog {
_log.warn(e.getMessage());
String authorizationUrl = genesysClient.getAuthorizationUrl(null);
VerifierDialog vd = new VerifierDialog(getParent(), SWT.NONE);
String verifierCode = vd.open(authorizationUrl).trim();
_log.info("Got verifier code: " + verifierCode);
String verifierCode = vd.open(authorizationUrl);
if (StringUtils.isNotBlank(verifierCode)) {
verifierCode = verifierCode.trim();
_log.info("Got verifier code: " + verifierCode);
try {
genesysClient.authenticate(verifierCode);
oauthSettings.setAccessToken(genesysClient.getAccessToken().getToken());
......@@ -257,11 +259,8 @@ public class SettingsDialog extends Dialog {
}
} catch (HttpRedirectException e) {
_log.error(e.getMessage(), e);
SwtUtil.showMessageBox(
getParent(),
"Server redirect",
"Server is redirecting to a different URL. Check your Genesys Server URL!\n\n"
+ e.getRedirectUrl());
SwtUtil.showMessageBox(getParent(), "Server redirect",
"Server is redirecting to a different URL. Check your Genesys Server URL!\n\n" + e.getRedirectUrl());
} catch (PleaseRetryException e) {
_log.error("Please retry", 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