Skip to content

Commit

Permalink
[JENKINS-26143] Apparently only List is allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-beck committed Mar 12, 2018
1 parent 7b8e4b1 commit f0e5687
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -16,7 +16,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Arrays;

Expand Down Expand Up @@ -93,17 +92,17 @@ public void setChoices(Object choices) {
setChoicesText((String) choices);
return;
}
if (choices instanceof Collection) {
if (choices instanceof List) {
ArrayList<String> newChoices = new ArrayList<>();
for (Object o : (Collection) choices) {
for (Object o : (List) choices) {
if (o != null) {
newChoices.add(o.toString());
}
}
this.choices = newChoices;
return;
}
throw new IllegalArgumentException("expected String or Collection, but got " + choices.getClass().getName());
throw new IllegalArgumentException("expected String or List, but got " + choices.getClass().getName());
}

private void setChoicesText(String choices) {
Expand Down

0 comments on commit f0e5687

Please sign in to comment.