Skip to content

Commit

Permalink
Make userId transient
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Sicker <boards@gmail.com>
  • Loading branch information
jvz committed Jul 23, 2019
1 parent 6e9b44f commit a3098b5
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.cloudbees.plugins.credentials.common.StandardCredentials;
import com.cloudbees.plugins.credentials.domains.Domain;
import com.cloudbees.plugins.credentials.domains.DomainRequirement;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.EnvVars;
import hudson.Util;
Expand Down Expand Up @@ -45,7 +46,7 @@ public class CredentialsParameterValue extends ParameterValue {
/**
* The user who supplied the parameter value.
*/
private String userId;
private transient final String userId;

@DataBoundConstructor
public CredentialsParameterValue(String name, String value, String description) {
Expand All @@ -63,20 +64,14 @@ public CredentialsParameterValue(String name, String value, String description,
this.userId = userId;
}

private Object readResolve() {
if (userId == null) {
userId = Jenkins.getAuthentication().getName();
}
return this;
}

public String getValue() {
return value;
}

/**
* Returns the user id of who filled in this credentials parameter.
*/
@CheckForNull
String getUserId() {
return userId;
}
Expand Down

0 comments on commit a3098b5

Please sign in to comment.