Treat empty username as non-existing username
Some callers of AccountState#getUserName and IdentifiedUser#getUserName() explicitly check that the user name is non-empty to then treat it the same way as a non-existing user name. Save the callers from this effort and move this check to a generic place. Change-Id: I65cc3403405ec702a0c30ca1f4b17555d97c1315 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -291,7 +291,10 @@ public class IdentifiedUser extends CurrentUser {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
/** @return the user's user name; null if one has not been selected/assigned. */
|
||||
/**
|
||||
* @return the user's user name; null if one has not been selected/assigned or if the user name is
|
||||
* empty.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String getUserName() {
|
||||
@@ -380,7 +383,7 @@ public class IdentifiedUser extends CurrentUser {
|
||||
// necessarily want to publish through Git records.
|
||||
//
|
||||
String user = getUserName();
|
||||
if (user == null || user.isEmpty()) {
|
||||
if (user == null) {
|
||||
user = "account-" + ua.getId().toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user