Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 8fd9383

Browse files
committed
Fix to retain persisted values for test artifacts
1 parent 1a284ff commit 8fd9383

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

src/main/java/com/mathworks/ci/RunMatlabTestsBuilder.java

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,27 @@ private EnvVars getEnv() {
152152

153153
// To retain Backward compatibility
154154
protected Object readResolve() {
155-
// Assign default values to new elements.
156-
this.pdfReportArtifact = new NullArtifact();
157-
this.tapArtifact = new NullArtifact();
158-
this.junitArtifact = new NullArtifact();
159-
this.coberturaArtifact = new NullArtifact();
160-
this.stmResultsArtifact = new NullArtifact();
161-
this.modelCoverageArtifact = new NullArtifact();
162-
163-
// Assign appropriate artifact type if it was selected earlier.
155+
// Assign default values to new elements if not already deserialized from config.
156+
if (this.pdfReportArtifact == null) {
157+
this.pdfReportArtifact = new NullArtifact();
158+
}
159+
if (this.tapArtifact == null) {
160+
this.tapArtifact = new NullArtifact();
161+
}
162+
if (this.junitArtifact == null) {
163+
this.junitArtifact = new NullArtifact();
164+
}
165+
if (this.coberturaArtifact == null) {
166+
this.coberturaArtifact = new NullArtifact();
167+
}
168+
if (this.stmResultsArtifact == null) {
169+
this.stmResultsArtifact = new NullArtifact();
170+
}
171+
if (this.modelCoverageArtifact == null) {
172+
this.modelCoverageArtifact = new NullArtifact();
173+
}
174+
175+
// Assign appropriate artifact type if it was selected in release 2.0.0 or earlier.
164176
if (pdfReportChkBx) {
165177
this.pdfReportArtifact = new PdfArtifact("matlabTestArtifacts/testreport.pdf");
166178
}

0 commit comments

Comments
 (0)