tiny improvements

This commit is contained in:
Oscar Salvador Morillo Victoria 2016-05-17 21:53:12 +02:00
parent fa8fcea8bd
commit 477ab67cd5
1 changed files with 4 additions and 3 deletions

View File

@ -18,6 +18,7 @@ import hudson.util.ListBoxModel;
import jenkins.model.GlobalConfiguration;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.eclipse.jgit.util.StringUtils;
import org.jenkinsci.plugins.plaincredentials.StringCredentials;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
@ -70,7 +71,7 @@ public class GitLabConnectionConfig extends GlobalConfiguration {
}
public FormValidation doCheckName(@QueryParameter String id, @QueryParameter String value) {
if (value == null || value.isEmpty()) {
if (StringUtils.isEmptyOrNull(value)) {
return FormValidation.error(Messages.name_required());
} else if (connectionMap.containsKey(value) && !connectionMap.get(value).toString().equals(id)) {
return FormValidation.error(Messages.name_exists(value));
@ -80,7 +81,7 @@ public class GitLabConnectionConfig extends GlobalConfiguration {
}
public FormValidation doCheckUrl(@QueryParameter String value) {
if (value == null || value.isEmpty()) {
if (StringUtils.isEmptyOrNull(value)) {
return FormValidation.error(Messages.url_required());
} else {
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
public FormValidation doCheckApiTokenId(@QueryParameter String value) {
if (value == null || value.isEmpty()) {
if (StringUtils.isEmptyOrNull(value)) {
return FormValidation.error(Messages.apiToken_required());
} else {
return FormValidation.ok();