Skip to content

Commit

Permalink
[JENKINS-22991] Merge pull request #1167 from christ66/ZD-16606
Browse files Browse the repository at this point in the history
Fix issue where restart would not properly display username if user was not loaded.
(cherry picked from commit 22e64ab)
  • Loading branch information
ndeloof authored and olivergondza committed Jun 8, 2014
1 parent 819c1f1 commit fde98ad
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions core/src/main/java/hudson/model/Cause.java
Expand Up @@ -327,8 +327,7 @@ public UserCause() {

@Exported(visibility=3)
public String getUserName() {
User u = User.get(authenticationName, false);
return u != null ? u.getDisplayName() : authenticationName;
return User.get(authenticationName).getDisplayName();
}

@Override
Expand Down Expand Up @@ -369,13 +368,7 @@ public String getUserId() {

@Exported(visibility = 3)
public String getUserName() {
String userName = "anonymous";
if (userId != null) {
User user = User.get(userId, false);
if (user != null)
userName = user.getDisplayName();
}
return userName;
return userId == null ? "anonymous" : User.get(userId).getDisplayName();
}

@Override
Expand Down

0 comments on commit fde98ad

Please sign in to comment.