tiny improvements
This commit is contained in:
parent
fa8fcea8bd
commit
477ab67cd5
|
@ -18,6 +18,7 @@ import hudson.util.ListBoxModel;
|
||||||
import jenkins.model.GlobalConfiguration;
|
import jenkins.model.GlobalConfiguration;
|
||||||
import jenkins.model.Jenkins;
|
import jenkins.model.Jenkins;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
import org.eclipse.jgit.util.StringUtils;
|
||||||
import org.jenkinsci.plugins.plaincredentials.StringCredentials;
|
import org.jenkinsci.plugins.plaincredentials.StringCredentials;
|
||||||
import org.kohsuke.stapler.QueryParameter;
|
import org.kohsuke.stapler.QueryParameter;
|
||||||
import org.kohsuke.stapler.StaplerRequest;
|
import org.kohsuke.stapler.StaplerRequest;
|
||||||
|
@ -70,7 +71,7 @@ public class GitLabConnectionConfig extends GlobalConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
public FormValidation doCheckName(@QueryParameter String id, @QueryParameter String value) {
|
public FormValidation doCheckName(@QueryParameter String id, @QueryParameter String value) {
|
||||||
if (value == null || value.isEmpty()) {
|
if (StringUtils.isEmptyOrNull(value)) {
|
||||||
return FormValidation.error(Messages.name_required());
|
return FormValidation.error(Messages.name_required());
|
||||||
} else if (connectionMap.containsKey(value) && !connectionMap.get(value).toString().equals(id)) {
|
} else if (connectionMap.containsKey(value) && !connectionMap.get(value).toString().equals(id)) {
|
||||||
return FormValidation.error(Messages.name_exists(value));
|
return FormValidation.error(Messages.name_exists(value));
|
||||||
|
@ -80,7 +81,7 @@ public class GitLabConnectionConfig extends GlobalConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
public FormValidation doCheckUrl(@QueryParameter String value) {
|
public FormValidation doCheckUrl(@QueryParameter String value) {
|
||||||
if (value == null || value.isEmpty()) {
|
if (StringUtils.isEmptyOrNull(value)) {
|
||||||
return FormValidation.error(Messages.url_required());
|
return FormValidation.error(Messages.url_required());
|
||||||
} else {
|
} else {
|
||||||
return FormValidation.ok();
|
return FormValidation.ok();
|
||||||
|
@ -89,7 +90,7 @@ public class GitLabConnectionConfig extends GlobalConfiguration {
|
||||||
|
|
||||||
// TODO check why this gets called twice on page load once with the correct id and once with an empty string
|
// TODO check why this gets called twice on page load once with the correct id and once with an empty string
|
||||||
public FormValidation doCheckApiTokenId(@QueryParameter String value) {
|
public FormValidation doCheckApiTokenId(@QueryParameter String value) {
|
||||||
if (value == null || value.isEmpty()) {
|
if (StringUtils.isEmptyOrNull(value)) {
|
||||||
return FormValidation.error(Messages.apiToken_required());
|
return FormValidation.error(Messages.apiToken_required());
|
||||||
} else {
|
} else {
|
||||||
return FormValidation.ok();
|
return FormValidation.ok();
|
||||||
|
|
Loading…
Reference in New Issue