Skip to content

Commit

Permalink
Add doCheckDisplayNameOrNull to jenkins core (#9150)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Beck <[email protected]>
  • Loading branch information
krisstern and daniel-beck authored Aug 30, 2024
1 parent 7a88dc3 commit a075ffb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 0 additions & 5 deletions core/src/main/java/hudson/model/AbstractProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -1934,11 +1934,6 @@ public boolean isApplicable(Descriptor descriptor) {
return true;
}

@Restricted(DoNotUse.class)
public FormValidation doCheckDisplayNameOrNull(@AncestorInPath AbstractProject project, @QueryParameter String value) {
return Jenkins.get().doCheckDisplayName(value, project.getName());
}

@Restricted(DoNotUse.class)
public FormValidation doCheckAssignedLabelString(@AncestorInPath AbstractProject<?, ?> project,
@QueryParameter String value) {
Expand Down
9 changes: 9 additions & 0 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,7 +38,11 @@
import org.jenkins.ui.icon.Icon;
import org.jenkins.ui.icon.IconSet;
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.MetaClass;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.WebApp;
Expand Down Expand Up @@ -286,4 +291,8 @@ public static ExtensionList<TopLevelItemDescriptor> all() {
return Items.all();
}

@Restricted(NoExternalUse.class)
public FormValidation doCheckDisplayNameOrNull(@AncestorInPath TopLevelItem item, @QueryParameter String value) {
return Jenkins.get().doCheckDisplayName(value, item.getName());
}
}

0 comments on commit a075ffb

Please sign in to comment.