Skip to content
Permalink
Browse files

[JENKINS-34900] getRootBuild() returns itself when there's no parent. (

  • Loading branch information
ikedam authored and aheritier committed Aug 26, 2016
1 parent d2554dd commit aacdd9d8b07fbf7fb7493243fa26a38dc5f601a0
@@ -176,11 +176,12 @@ public String getDisplayName() {
}

/**
* The same as {@link #getParentBuild()}.
* The same as {@link #getParentBuild()} except that returns itself when no parent.
*/
@Override
public AbstractBuild<?, ?> getRootBuild() {
return getParentBuild();
AbstractBuild<?, ?> parent = getParentBuild();
return (parent != null) ? parent : this;
}

/**
@@ -278,6 +278,11 @@ public void testSingleModuleBuild() throws Exception {
for(MavenModule module : expectedNonBuiltModules) {
assertEquals(1,module.getLastBuild().getNumber());
}

// AbstractBuild#getRootBuild() never be null.
assertNotNull(isolated.getRootBuild());
// as there's no parent build, rootBuild is itself.
assertEquals(isolated, isolated.getRootBuild());
}

@Bug(12109)

0 comments on commit aacdd9d

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