Skip to content
Permalink
Browse files

[FIXED JENKINS-19135] Permit a user to configure an axis with no valu…

…es 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).
  • Loading branch information
jglick committed Aug 14, 2013
1 parent b52e32e commit 58c8a9393fbe31e4533343229603cae47723cc6e
Showing with 11 additions and 4 deletions.
  1. +3 −0 changelog.html
  2. +3 −2 core/src/main/java/hudson/matrix/Axis.java
  3. +5 −2 core/src/main/java/hudson/matrix/Layouter.java
@@ -55,6 +55,9 @@
<!-- 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 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 T get(int zp) {
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));
}

0 comments on commit 58c8a93

Please sign in to comment.
You can’t perform that action at this time.