diff --git a/changelog.html b/changelog.html
index 0dbcac118bd14085ffcaf61e8f2a10293d4e9e8f..8c7f69a1d3f8e660d652efc126efd8a951f13252 100644
--- a/changelog.html
+++ b/changelog.html
@@ -55,6 +55,9 @@ Upcoming changes
+ -
+ Ungraceful handling of empty matrix project axes.
+ (issue 19135)
-
A malformed JUnit result file should mark that test suite as a failure, but not interrupt archiving of other tests.
(issue 19186)
diff --git a/core/src/main/java/hudson/matrix/Axis.java b/core/src/main/java/hudson/matrix/Axis.java
index c776f6ad044e3e8138c289b6fb27b2a2a66e5f31..faec4501e1d3696f0960e5e22d9c555ffd0b48ac 100644
--- a/core/src/main/java/hudson/matrix/Axis.java
+++ b/core/src/main/java/hudson/matrix/Axis.java
@@ -76,10 +76,11 @@ public class Axis extends AbstractDescribableImpl implements Comparable values;
public Axis(String name, List values) {
+ if (values == null || values.isEmpty()) {
+ values = Collections.emptyList();
+ }
this.name = name;
this.values = new ArrayList(values);
- if(values.isEmpty())
- throw new IllegalArgumentException(); // bug in the code
}
public Axis(String name, String... values) {
diff --git a/core/src/main/java/hudson/matrix/Layouter.java b/core/src/main/java/hudson/matrix/Layouter.java
index 941a38de108eea021ca3e1ab47a0843884215efd..051b8f6239166261f21adab3aacfa7a21a371169 100644
--- a/core/src/main/java/hudson/matrix/Layouter.java
+++ b/core/src/main/java/hudson/matrix/Layouter.java
@@ -201,8 +201,11 @@ public abstract class Layouter {
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));
}