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

Add doCheckDisplayNameOrNull to jenkins core #9150

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 @@ -134,7 +134,7 @@
* @see AbstractBuild
*/
@SuppressWarnings("rawtypes")
public abstract class AbstractProject<P extends AbstractProject<P, R>, R extends AbstractBuild<P, R>> extends Job<P, R> implements BuildableItem, LazyBuildMixIn.LazyLoadingJob<P, R>, ParameterizedJobMixIn.ParameterizedJob<P, R> {

Check warning on line 137 in core/src/main/java/hudson/model/AbstractProject.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: Note: Generating hudson/model/AbstractProject.javadoc

/**
* {@link SCM} associated with the project.
Expand Down Expand Up @@ -682,7 +682,7 @@
/**
* Validates the retry count Regex
*/
public FormValidation doCheckRetryCount(@QueryParameter String value)throws IOException, ServletException {

Check warning on line 685 in core/src/main/java/hudson/model/AbstractProject.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: Note: Generating hudson/model/AbstractProject/doCheckRetryCount.stapler
// retry count is optional so this is ok
if (value == null || value.trim().isEmpty())
return FormValidation.ok();
Expand Down Expand Up @@ -1934,13 +1934,8 @@
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,

Check warning on line 1938 in core/src/main/java/hudson/model/AbstractProject.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: Note: Generating hudson/model/AbstractProject/AbstractProjectDescriptor/doCheckAssignedLabelString.stapler

Check warning on line 1938 in core/src/main/java/hudson/model/AbstractProject.java

View check run for this annotation

ci.jenkins.io / Java Compiler

access-modifier-checker:enforce

NORMAL: Note: Generating hudson/model/AbstractProject/AbstractProjectDescriptor/doCheckAssignedLabelString.stapler
@QueryParameter String value) {
// Provide a legacy interface in case plugins are not going through p:config-assignedLabel
// see: JENKINS-25372
Expand All @@ -1948,7 +1943,7 @@
return doCheckLabel(project, value);
}

public FormValidation doCheckLabel(@AncestorInPath AbstractProject<?, ?> project,

Check warning on line 1946 in core/src/main/java/hudson/model/AbstractProject.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: Note: Generating hudson/model/AbstractProject/AbstractProjectDescriptor/doCheckLabel.stapler
@QueryParameter String value) {
return LabelExpression.validate(value, project);
}
Expand All @@ -1965,14 +1960,14 @@
return LabelExpression.validate(value, project);
}

public FormValidation doCheckCustomWorkspace(@QueryParameter String customWorkspace) {

Check warning on line 1963 in core/src/main/java/hudson/model/AbstractProject.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: Note: Generating hudson/model/AbstractProject/AbstractProjectDescriptor/doCheckCustomWorkspace.stapler
if (Util.fixEmptyAndTrim(customWorkspace) == null)
return FormValidation.error(Messages.AbstractProject_CustomWorkspaceEmpty());
else
return FormValidation.ok();
}

public AutoCompletionCandidates doAutoCompleteUpstreamProjects(@QueryParameter String value) {

Check warning on line 1970 in core/src/main/java/hudson/model/AbstractProject.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: Note: Generating hudson/model/AbstractProject/AbstractProjectDescriptor/doAutoCompleteUpstreamProjects.stapler
AutoCompletionCandidates candidates = new AutoCompletionCandidates();
List<TopLevelItem> jobs = Jenkins.get().getItems(j -> j instanceof Job && j.getFullName().startsWith(value));
for (TopLevelItem job : jobs) {
Expand All @@ -1982,14 +1977,14 @@
}

@Restricted(DoNotUse.class)
public AutoCompletionCandidates doAutoCompleteAssignedLabelString(@QueryParameter String value) {

Check warning on line 1980 in core/src/main/java/hudson/model/AbstractProject.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: Note: Generating hudson/model/AbstractProject/AbstractProjectDescriptor/doAutoCompleteAssignedLabelString.stapler
// Provide a legacy interface in case plugins are not going through p:config-assignedLabel
// see: JENKINS-25372
LOGGER.log(Level.WARNING, "autocompleting label via legacy '_.assignedLabelString'");
return doAutoCompleteLabel(value);
}

public AutoCompletionCandidates doAutoCompleteLabel(@QueryParameter String value) {

Check warning on line 1987 in core/src/main/java/hudson/model/AbstractProject.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: Note: Generating hudson/model/AbstractProject/AbstractProjectDescriptor/doAutoCompleteLabel.stapler
return LabelExpression.autoComplete(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 @@
return Items.all();
}

@Restricted(NoExternalUse.class)
public FormValidation doCheckDisplayNameOrNull(@AncestorInPath TopLevelItem item, @QueryParameter String value) {

Check warning on line 295 in core/src/main/java/hudson/model/TopLevelItemDescriptor.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: Note: Generating hudson/model/TopLevelItemDescriptor/doCheckDisplayNameOrNull.stapler
return Jenkins.get().doCheckDisplayName(value, item.getName());
}
}
Loading