Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings #233

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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