本文整理了Java中hudson.Util.fixEmptyAndTrim()
方法的一些代码示例,展示了Util.fixEmptyAndTrim()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.fixEmptyAndTrim()
方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:fixEmptyAndTrim
[英]Convert empty string to null, and trim whitespace.
[中]将空字符串转换为null,并修剪空白。
代码示例来源:origin: jenkinsci/jenkins
/**
* Set the salt value. Must not be null.
* @param salt
*/
public void setCrumbSalt(String salt) {
if (Util.fixEmptyAndTrim(salt) == null) {
crumbSalt = "hudson.crumb";
} else {
crumbSalt = salt;
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Subclasses should pass these parameters in using {@link DataBoundConstructor}.
*/
protected ToolInstaller(String label) {
this.label = Util.fixEmptyAndTrim(label);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Sets the human readable name of the user.
* If the input parameter is empty, the user's ID will be set.
*/
public void setFullName(String name) {
if (Util.fixEmptyAndTrim(name) == null) name = id;
this.fullName = name;
}
代码示例来源:origin: jenkinsci/jenkins
@Override
protected String parse(String line) {
return Util.fixEmptyAndTrim(line);
}
代码示例来源:origin: jenkinsci/jenkins
@DataBoundConstructor
public MavenInstallation(String name, String home, List<? extends ToolProperty<?>> properties) {
super(Util.fixEmptyAndTrim(name), Util.fixEmptyAndTrim(home), properties);
}
代码示例来源:origin: jenkinsci/jenkins
@DataBoundConstructor
public ZipExtractionInstaller(String label, String url, String subdir) {
super(label);
this.url = url;
this.subdir = Util.fixEmptyAndTrim(subdir);
}
代码示例来源:origin: jenkinsci/jenkins
@DataBoundConstructor
public JNLPLauncher(@CheckForNull String tunnel, @CheckForNull String vmargs) {
this.tunnel = Util.fixEmptyAndTrim(tunnel);
this.vmargs = Util.fixEmptyAndTrim(vmargs);
}
代码示例来源:origin: jenkinsci/jenkins
@DataBoundConstructor
public RemotingWorkDirSettings(boolean disabled,
@CheckForNull String workDirPath, @CheckForNull String internalDir,
boolean failIfWorkDirIsMissing) {
this.disabled = disabled;
this.workDirPath = Util.fixEmptyAndTrim(workDirPath);
this.failIfWorkDirIsMissing = failIfWorkDirIsMissing;
String internalDirName = Util.fixEmptyAndTrim(internalDir);
this.internalDir = internalDirName != null ? internalDirName : DEFAULT_INTERNAL_DIR;
}
代码示例来源:origin: jenkinsci/jenkins
@DataBoundConstructor
public ProxyConfiguration(String name, int port, String userName, String password, String noProxyHost, String testUrl) {
this.name = Util.fixEmptyAndTrim(name);
this.port = port;
this.userName = Util.fixEmptyAndTrim(userName);
this.secretPassword = Secret.fromString(password);
this.noProxyHost = Util.fixEmptyAndTrim(noProxyHost);
this.testUrl = Util.fixEmptyAndTrim(testUrl);
this.authenticator = newAuthenticator();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Makes sure that the given string is not null or empty.
*/
public static FormValidation validateRequired(String value) {
if (Util.fixEmptyAndTrim(value) == null)
return error(Messages.FormValidation_ValidateRequired());
return ok();
}
代码示例来源:origin: jenkinsci/jenkins
public FormValidation doCheckCustomWorkspace(@QueryParameter String customWorkspace){
if(Util.fixEmptyAndTrim(customWorkspace)==null)
return FormValidation.error(Messages.AbstractProject_CustomWorkspaceEmpty());
else
return FormValidation.ok();
}
代码示例来源:origin: jenkinsci/jenkins
public void setDisplayName(String displayName) throws IOException {
this.displayName = Util.fixEmptyAndTrim(displayName);
save();
}
代码示例来源:origin: jenkinsci/jenkins
public void setShell(String shell) {
this.shell = Util.fixEmptyAndTrim(shell);
save();
}
代码示例来源:origin: jenkinsci/jenkins
@DataBoundConstructor
public Maven(String targets,String name, String pom, String properties, String jvmOptions, boolean usePrivateRepository, SettingsProvider settings, GlobalSettingsProvider globalSettings, boolean injectBuildVariables) {
this.targets = targets;
this.mavenName = name;
this.pom = Util.fixEmptyAndTrim(pom);
this.properties = Util.fixEmptyAndTrim(properties);
this.jvmOptions = Util.fixEmptyAndTrim(jvmOptions);
this.usePrivateRepository = usePrivateRepository;
this.settings = settings != null ? settings : GlobalMavenConfig.get().getSettingsProvider();
this.globalSettings = globalSettings != null ? globalSettings : GlobalMavenConfig.get().getGlobalSettingsProvider();
this.injectBuildVariables = injectBuildVariables;
}
代码示例来源:origin: jenkinsci/jenkins
protected void submit(JSONObject json) throws IOException {
setDisplayName(Util.fixEmptyAndTrim(json.getString("displayName")));
setDescription(json.getString("description"));
}
代码示例来源:origin: jenkinsci/jenkins
public FormValidation doCheckName(@QueryParameter String value ) {
String name = Util.fixEmptyAndTrim(value);
if(name==null)
return FormValidation.error(Messages.NodeDescriptor_CheckName_Mandatory());
try {
Jenkins.checkGoodName(name);
} catch (Failure f) {
return FormValidation.error(f.getMessage());
}
return FormValidation.ok();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Performs syntactical check on the remote FS for agents.
*/
public FormValidation doCheckRemoteFS(@QueryParameter String value) throws IOException, ServletException {
if(Util.fixEmptyAndTrim(value)==null)
return FormValidation.error(Messages.Slave_Remote_Director_Mandatory());
if(value.startsWith("\\\\") || value.startsWith("/net/"))
return FormValidation.warning(Messages.Slave_Network_Mounted_File_System_Warning());
if (Util.isRelativePath(value)) {
return FormValidation.warning(Messages.Slave_Remote_Relative_Path_Warning());
}
return FormValidation.ok();
}
代码示例来源:origin: jenkinsci/jenkins
@RequirePOST
public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) {
if (channel!=null) {
//does nothing in case computer is already disconnected
checkPermission(DISCONNECT);
offlineMessage = Util.fixEmptyAndTrim(offlineMessage);
disconnect(new OfflineCause.UserCause(User.current(), offlineMessage));
}
return new HttpRedirect(".");
}
代码示例来源:origin: jenkinsci/jenkins
@RequirePOST
public HttpResponse doChangeOfflineCause(@QueryParameter String offlineMessage) throws IOException, ServletException {
checkPermission(DISCONNECT);
offlineMessage = Util.fixEmptyAndTrim(offlineMessage);
setTemporarilyOffline(true,
new OfflineCause.UserCause(User.current(), offlineMessage));
return HttpResponses.redirectToDot();
}
代码示例来源:origin: jenkinsci/jenkins
@RequirePOST
public HttpResponse doToggleOffline(@QueryParameter String offlineMessage) throws IOException, ServletException {
if(!temporarilyOffline) {
checkPermission(DISCONNECT);
offlineMessage = Util.fixEmptyAndTrim(offlineMessage);
setTemporarilyOffline(!temporarilyOffline,
new OfflineCause.UserCause(User.current(), offlineMessage));
} else {
checkPermission(CONNECT);
setTemporarilyOffline(!temporarilyOffline,null);
}
return HttpResponses.redirectToDot();
}
内容来源于网络,如有侵权,请联系作者删除!