summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-23 08:21:13 (EST)
committer Winston Prakash2011-12-01 20:47:11 (EST)
commitecd2c35e8635209e96dfc78650c0465fca7512fb (patch)
tree857870b27abeda681df0af450574f6ddbcd6efbc
parentb946880ad46e2a5f85dcdbc6c3ee1f53bdb66d16 (diff)
downloadorg.eclipse.hudson.core-ecd2c35e8635209e96dfc78650c0465fca7512fb.zip
org.eclipse.hudson.core-ecd2c35e8635209e96dfc78650c0465fca7512fb.tar.gz
org.eclipse.hudson.core-ecd2c35e8635209e96dfc78650c0465fca7512fb.tar.bz2
Fixed issue with cascading matrix child project loading.
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/matrix/MatrixProject.java44
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/AxisListProjectProperty.java5
2 files changed, 30 insertions, 19 deletions
diff --git a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
index 4a7f508..599e26a 100644
--- a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
+++ b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
@@ -51,6 +51,7 @@ import hudson.util.DescribableListUtil;
import hudson.util.FormValidation;
import hudson.util.FormValidation.Kind;
import net.sf.json.JSONObject;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.eclipse.hudson.api.matrix.IMatrixProject;
import org.kohsuke.stapler.HttpResponse;
@@ -208,7 +209,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
public void setAxes(AxisList axes) throws IOException {
getAxesListProjectProperty(AXES_PROPERTY_NAME).setValue(axes);
// rebuildConfigurations();
-// save();
+ save();
}
/**
@@ -223,7 +224,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
*/
public void setRunSequentially(boolean runSequentially) throws IOException {
getBooleanProperty(RUN_SEQUENTIALLY_PROPERTY_NAME).setValue(runSequentially);
-// save();
+ save();
}
/**
@@ -239,9 +240,8 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
public void setCombinationFilter(String combinationFilter) throws IOException {
getStringProperty(COMBINATION_FILTER_PROPERTY_NAME).setValue(combinationFilter);
// rebuildConfigurations();
-// save();
+ save();
}
-
/**
* @inheritDoc
*/
@@ -424,8 +424,12 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
@Override
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException {
- super.onLoad(parent,name);
- Collections.sort(getAxes()); // perhaps the file was edited on disk and the sort order might have been broken
+ super.onLoad(parent, name);
+ AxisList axes = getAxes();
+ if (!CollectionUtils.isEmpty(axes)) {
+ // perhaps the file was edited on disk and the sort order might have been broken
+ Collections.sort(getAxes());
+ }
getBuildersList().setOwner(this);
getPublishersList().setOwner(this);
getBuildWrappersList().setOwner(this);
@@ -536,19 +540,21 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
// find all active configurations
Set<MatrixConfiguration> active = new LinkedHashSet<MatrixConfiguration>();
- for (Combination c : getAxes().list()) {
- AxisList axes = getAxes();
- String combinationFilter = getCombinationFilter();
- if(c.evalGroovyExpression(axes,combinationFilter)) {
- LOGGER.fine("Adding configuration: " + c);
- MatrixConfiguration config = configurations.get(c);
- if(config==null) {
- config = new MatrixConfiguration(this,c);
- config.save();
- configurations.put(config.getCombination(), config);
- }
- active.add(config);
- }
+ AxisList axes = getAxes();
+ if (!CollectionUtils.isEmpty(axes)) {
+ for (Combination c : axes.list()) {
+ String combinationFilter = getCombinationFilter();
+ if (c.evalGroovyExpression(axes, combinationFilter)) {
+ LOGGER.fine("Adding configuration: " + c);
+ MatrixConfiguration config = configurations.get(c);
+ if (config == null) {
+ config = new MatrixConfiguration(this, c);
+ config.save();
+ configurations.put(config.getCombination(), config);
+ }
+ active.add(config);
+ }
+ }
}
this.activeConfigurations = active;
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/AxisListProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/AxisListProjectProperty.java
index b5fc6c5..4e92283 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/AxisListProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/AxisListProjectProperty.java
@@ -30,4 +30,9 @@ public class AxisListProjectProperty extends BaseProjectProperty<AxisList> {
public AxisListProjectProperty(IJob job) {
super(job);
}
+
+ @Override
+ public AxisList getDefaultValue() {
+ return new AxisList();
+ }
} \ No newline at end of file