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

[JENKINS-29582] Avoid null buildselector #63

Closed
Closed
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>copyartifact</artifactId>
<version>1.21</version>
<version>1.35.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/hudson/plugins/s3/S3CopyArtifact.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import hudson.plugins.copyartifact.Messages;
import hudson.plugins.copyartifact.ParametersBuildFilter;
import hudson.plugins.copyartifact.WorkspaceSelector;
import hudson.plugins.copyartifact.StatusBuildSelector;
import hudson.security.AccessControlled;
import hudson.security.SecurityRealm;
import hudson.tasks.BuildStepDescriptor;
Expand Down Expand Up @@ -101,16 +102,21 @@ public class S3CopyArtifact extends Builder {
private final String filter, target;
private /*almost final*/ BuildSelector selector;
private final Boolean flatten, optional;

private static final BuildSelector DEFAULT_BUILD_SELECTOR = new StatusBuildSelector(true);

@DataBoundConstructor
public S3CopyArtifact(String projectName, BuildSelector selector, String filter, String target,
public S3CopyArtifact(String projectName, BuildSelector buildSelector, String filter, String target,
boolean flatten, boolean optional) {
// Prevents both invalid values and access to artifacts of projects which this user cannot see.
// If value is parameterized, it will be checked when build runs.
if (projectName.indexOf('$') < 0 && new JobResolver(projectName).job == null)
projectName = ""; // Ignore/clear bad value to avoid ugly 500 page
this.projectName = projectName;
this.selector = selector;
if (buildSelector == null) {
buildSelector = DEFAULT_BUILD_SELECTOR;
}
this.selector = buildSelector;
this.filter = Util.fixNull(filter).trim();
this.target = Util.fixNull(target).trim();
this.flatten = flatten ? Boolean.TRUE : null;
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/hudson/plugins/s3/S3CopyArtifact.stapler

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form" xmlns:ca="/hudson/plugins/copyartifact">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<f:entry title="Project name" field="projectName">
<f:editableComboBox items="${app.topLevelItemNames}" clazz="setting-input"/>
</f:entry>
<ca:selectorList currentSelector="${instance.buildSelector}"
name="selector" title="Which build"/>
<f:dropdownDescriptorSelector field="buildSelector" help="/plugin/copyartifact/help-buildSelector.html"
name="buildSelector" title="Which build" descriptors="${descriptor.availableBuildSelectorList}" />
<f:entry title="Artifacts to copy" field="filter">
<f:textbox/>
</f:entry>
Expand Down
67 changes: 0 additions & 67 deletions src/main/resources/hudson/plugins/s3/selectorList.jelly

This file was deleted.