Skip to content

Commit

Permalink
No null Sod variables please
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed Jun 20, 2019
1 parent ed66f4a commit 3881e99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public class PluginImpl extends GlobalConfiguration {
/**
* ScanOnDemandVariable instance.
*/
private ScanOnDemandVariables sodVariables;
private ScanOnDemandVariables sodVariables = new ScanOnDemandVariables();

/**
* Default constructor.
Expand All @@ -159,6 +159,14 @@ public PluginImpl() {
load();
}

protected Object readResolve() {
if (sodVariables == null) {
this.sodVariables = new ScanOnDemandVariables();
}

return this;
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import java.util.concurrent.TimeUnit;

import jenkins.model.Jenkins;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
Expand All @@ -67,11 +66,6 @@ public class ScanOnDemandBaseActionTest {
@Rule
public JenkinsRule j = new JenkinsRule();

@Before
public void setup() {
PluginImpl.getInstance().setSodVariables(new ScanOnDemandVariables());
}

private static final String TO_PRINT = "ERROR";
/**
* Tests for performScanMethod by passing failed build.
Expand Down

0 comments on commit 3881e99

Please sign in to comment.