OpenIdServiceImpl: Fix incorrect null comparison of Optional

AccountManager.lookup() returns an Optional, not a nullable value,
so it's incorrect to compare to null. Instead, check the value of
the isPresent() method.

This was detected by SonarLint.

Change-Id: Iec0d2beee9059ecd0b53a6815a9b1f8a9ac41c50
This commit is contained in:
David Pursehouse
2020-02-19 16:40:03 +09:00
parent 956e85e329
commit 9a3f466ff7

View File

@@ -192,7 +192,7 @@ class OpenIdServiceImpl {
// We might already have this account on file. Look for it.
//
try {
return accountManager.lookup(aReq.getIdentity()) == null;
return !accountManager.lookup(aReq.getIdentity()).isPresent();
} catch (AccountException e) {
logger.atWarning().withCause(e).log("Cannot determine if user account exists");
return true;