From 51d790fd8facb17bb243f211bd133f86f32589fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9da=20Housni=20Alaoui?= Date: Sun, 9 Jul 2023 13:30:26 +0200 Subject: [PATCH] Code cleanup --- .../sonargerrit/gerrit/GerritAuthenticationConfig.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/sonargerrit/gerrit/GerritAuthenticationConfig.java b/src/main/java/org/jenkinsci/plugins/sonargerrit/gerrit/GerritAuthenticationConfig.java index fe250e5..b38ad6c 100644 --- a/src/main/java/org/jenkinsci/plugins/sonargerrit/gerrit/GerritAuthenticationConfig.java +++ b/src/main/java/org/jenkinsci/plugins/sonargerrit/gerrit/GerritAuthenticationConfig.java @@ -1,6 +1,5 @@ package org.jenkinsci.plugins.sonargerrit.gerrit; -import static hudson.Functions.checkPermission; import static org.jenkinsci.plugins.sonargerrit.util.Localization.getLocalized; import com.cloudbees.plugins.credentials.common.PasswordCredentials; @@ -19,10 +18,8 @@ import hudson.util.FormValidation; import hudson.util.ListBoxModel; import hudson.util.Secret; -import java.io.IOException; import java.util.List; import java.util.Optional; -import javax.servlet.ServletException; import org.kohsuke.stapler.AncestorInPath; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; @@ -131,9 +128,8 @@ public ListBoxModel doFillHttpCredentialsIdItems( public FormValidation doTestConnection( @AncestorInPath Item item, @QueryParameter("httpCredentialsId") final String httpCredentialsId, - @QueryParameter("serverName") final String serverName) - throws ServletException, IOException { - checkPermission(item, Item.CONFIGURE); + @QueryParameter("serverName") final String serverName) { + item.checkPermission(Item.CONFIGURE); FormValidation credentialsIdRequiredValidation = FormValidation.validateRequired(httpCredentialsId);