AccountsUpdate#update: Return Optional<AccountState> instead of AccountState
This makes it more explicit that callers must handle the case where the returned AccountState is absent. Change-Id: Id301678f97d2a8827c3a23d85cbc5f6da97abc7c Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -2981,7 +2981,7 @@ class ReceiveCommits {
|
||||
}
|
||||
logDebug("Updating full name of caller");
|
||||
try {
|
||||
AccountState accountState =
|
||||
Optional<AccountState> accountState =
|
||||
accountsUpdate
|
||||
.create()
|
||||
.update(
|
||||
@@ -2992,9 +2992,9 @@ class ReceiveCommits {
|
||||
u.setFullName(setFullNameTo);
|
||||
}
|
||||
});
|
||||
if (accountState != null) {
|
||||
user.getAccount().setFullName(accountState.getAccount().getFullName());
|
||||
}
|
||||
accountState
|
||||
.map(AccountState::getAccount)
|
||||
.ifPresent(a -> user.getAccount().setFullName(a.getFullName()));
|
||||
} catch (OrmException | IOException | ConfigInvalidException e) {
|
||||
logWarn("Failed to update full name of caller", e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user