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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user