Skip to content

Commit

Permalink
fix: move doCheckDisplayNameOrNull code to TopLevelItemDescriptor.java
Browse files Browse the repository at this point in the history
  • Loading branch information
krisstern committed Apr 9, 2024
1 parent 6be67f1 commit 30ce180
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
5 changes: 0 additions & 5 deletions core/src/main/java/hudson/model/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -1604,9 +1604,4 @@ public BuildTimelineWidget getTimeline() {
}

private static final HexStringConfidentialKey SERVER_COOKIE = new HexStringConfidentialKey(Job.class, "serverCookie", 16);

@Restricted(NoExternalUse.class)
public static FormValidation doCheckDisplayNameOrNull(@AncestorInPath AbstractProject<?, ?> project, @QueryParameter String value) {
return Jenkins.get().doCheckDisplayName(value, project.getName());
}
}
12 changes: 8 additions & 4 deletions core/src/main/java/hudson/model/TopLevelItemDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.ExtensionList;
import hudson.util.FormValidation;
import java.io.StringWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand All @@ -37,10 +38,9 @@
import org.jenkins.ui.icon.Icon;
import org.jenkins.ui.icon.IconSet;
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.stapler.MetaClass;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.WebApp;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.*;
import org.kohsuke.stapler.jelly.DefaultScriptInvoker;
import org.kohsuke.stapler.jelly.JellyClassTearOff;
import org.springframework.security.access.AccessDeniedException;
Expand Down Expand Up @@ -286,4 +286,8 @@ public static ExtensionList<TopLevelItemDescriptor> all() {
return Items.all();
}

@Restricted(NoExternalUse.class)
public static FormValidation doCheckDisplayNameOrNull(@AncestorInPath AbstractProject<?, ?> project, @QueryParameter String value) {
return Jenkins.get().doCheckDisplayName(value, project.getName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jenkins.model.Jenkins;
import org.apache.commons.io.IOUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand Down

0 comments on commit 30ce180

Please sign in to comment.