diff --git a/src/main/java/hudson/plugins/s3/S3BucketPublisher.java b/src/main/java/hudson/plugins/s3/S3BucketPublisher.java index e2a1000b..11f77219 100644 --- a/src/main/java/hudson/plugins/s3/S3BucketPublisher.java +++ b/src/main/java/hudson/plugins/s3/S3BucketPublisher.java @@ -24,6 +24,7 @@ import org.apache.commons.lang.StringUtils; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; +import org.kohsuke.stapler.DataBoundSetter; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; @@ -391,7 +392,7 @@ public BuildStepMonitor getRequiredMonitorService() { @Symbol("s3Upload") public static final class DescriptorImpl extends BuildStepDescriptor { - private final CopyOnWriteList profiles = new CopyOnWriteList(); + private List profiles = new ArrayList(); public static final Level[] consoleLogLevels = { Level.INFO, Level.WARNING, Level.SEVERE }; private static final Logger LOGGER = Logger.getLogger(DescriptorImpl.class.getName()); private static final Result[] pluginFailureResultConstraints = { Result.FAILURE, Result.UNSTABLE, Result.SUCCESS }; @@ -409,6 +410,11 @@ public DescriptorImpl() { this(S3BucketPublisher.class); } + @DataBoundSetter + public void setProfiles(List profiles) { + this.profiles = profiles; + } + @Override public String getDisplayName() { return "Publish artifacts to S3 Bucket"; @@ -423,9 +429,9 @@ public String getHelpFile() { public boolean configure(StaplerRequest req, JSONObject json) { final JSONArray array = json.optJSONArray("profile"); if (array != null) { - profiles.replaceBy(req.bindJSONToList(S3Profile.class, array)); + profiles = new ArrayList<>(req.bindJSONToList(S3Profile.class, array)); } else { - profiles.replaceBy(req.bindJSON(S3Profile.class, json.getJSONObject("profile"))); + profiles = new ArrayList<>(Arrays.asList(req.bindJSON(S3Profile.class, json.getJSONObject("profile")))); } save(); return true; @@ -459,7 +465,7 @@ public ListBoxModel doFillPluginFailureResultConstraintItems() { @SuppressWarnings("unused") public void replaceProfiles(List profiles) { - this.profiles.replaceBy(profiles); + this.profiles = new ArrayList<>(profiles); save(); }