Skip to content

Commit

Permalink
Fix warnings (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Mar 24, 2023
1 parent d309e4c commit 05f1320
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@
import javax.servlet.ServletException;
import jenkins.YesNoMaybe;
import jenkins.model.GlobalConfiguration;
import jenkins.model.Jenkins;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.verb.POST;

/**
* Global configuration for the Timestamper plug-in, as shown on the Jenkins Configure System page.
Expand Down Expand Up @@ -111,8 +113,11 @@ public void setSystemTimeFormat(@CheckForNull String timestampFormat) {
save();
}

@POST
public FormValidation doCheckSystemTimeFormat(@QueryParameter String systemTimeFormat)
throws IOException, ServletException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);

if (Util.fixEmptyAndTrim(systemTimeFormat) == null) {
return FormValidation.ok();
}
Expand Down Expand Up @@ -140,8 +145,11 @@ public void setElapsedTimeFormat(@CheckForNull String elapsedTimeFormat) {
save();
}

@POST
public FormValidation doCheckElapsedTimeFormat(@QueryParameter String elapsedTimeFormat)
throws IOException, ServletException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);

if (Util.fixEmptyAndTrim(elapsedTimeFormat) == null) {
return FormValidation.ok();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public String getUrlName() {
}

/** Serve a page at this URL. */
@SuppressWarnings({"lgtm[jenkins/csrf]", "lgtm[jenkins/no-permission-check]"})
public void doIndex(StaplerRequest request, StaplerResponse response) throws IOException {
response.setContentType("text/plain;charset=UTF-8");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public String getHelpFile() {

/** Serve the help file. */
@Override
@SuppressWarnings({"lgtm[jenkins/csrf]", "lgtm[jenkins/no-permission-check]"})
public void doHelp(StaplerRequest request, StaplerResponse response) throws IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter writer = response.getWriter();
Expand Down

0 comments on commit 05f1320

Please sign in to comment.