提交 58c8a939 编写于 作者: J Jesse Glick

[FIXED JENKINS-19135] Permit a user to configure an axis with no values...

[FIXED JENKINS-19135] Permit a user to configure an axis with no values without throwing exceptions.
The project cannot be usefully built in this case but at least they can go back and reconfigure it.
Also fixing Layouter.Column to not throw NoSuchElementException (in violation of Iterator contract)
and thus break project overview when there is an empty Axis in the trivial list (due to an unintentional IndexOutOfBoundsException).
上级 b52e32ed
......@@ -55,6 +55,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=bug>
Ungraceful handling of empty matrix project axes.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19135">issue 19135</a>)
<li class=bug>
A malformed JUnit result file should mark that test suite as a failure, but not interrupt archiving of other tests.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19186">issue 19186</a>)
......
......@@ -76,10 +76,11 @@ public class Axis extends AbstractDescribableImpl<Axis> implements Comparable<Ax
public final List<String> values;
public Axis(String name, List<String> values) {
if (values == null || values.isEmpty()) {
values = Collections.emptyList();
}
this.name = name;
this.values = new ArrayList<String>(values);
if(values.isEmpty())
throw new IllegalArgumentException(); // bug in the code
}
public Axis(String name, String... values) {
......
......@@ -201,8 +201,11 @@ public abstract class Layouter<T> {
buildMap(xp,x);
buildMap(yp,y);
buildMap(zp,z);
for (Axis a : trivial)
m.put(a.name,a.value(0));
for (Axis a : trivial) {
if (a.size() > 0) {
m.put(a.name, a.value(0));
}
}
return getT(new Combination(m));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册