Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ private String key() {

// super.reload() forces result to be FAILURE, so working around that
new XmlFile(XSTREAM,new File(getRootDir(),"build.xml")).unmarshal(this);
var _execution = execution;
if (_execution != null) {
_execution.onLoad(new Owner(this));
}
}

@Override protected void onLoad() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -600,6 +601,15 @@ private void assertCulprits(WorkflowRun b, String... expectedIds) throws IOExcep
assertPollingBaselines(b3.checkouts(listener), nullValue(), nullValue());
}

@Test public void reloadOwner() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("", true));
WorkflowRun b = r.buildAndAssertSuccess(p);
assertThat("right owner before reload", b.getExecution().getOwner(), is(b.asFlowExecutionOwner()));
b.reload();
assertThat("right owner after reload", b.getExecution().getOwner(), is(b.asFlowExecutionOwner()));
}

// This test is to ensure that the shortDescription on the CancelCause is escaped properly on summary.jelly
@Issue("SECURITY-3042")
@Test public void escapedDisplayNameAfterAbort() throws Exception {
Expand Down