Skip to content
Permalink
Browse files
[JENKINS-39169] fixed circular dependency warning on startup
  • Loading branch information
cpoenisch committed Oct 21, 2016
1 parent a976cf4 commit 5313443771bc8435ed8e6c3617d6114be30d978d
@@ -38,6 +38,8 @@

import org.apache.commons.lang.builder.HashCodeBuilder;

import de.tracetronic.jenkins.plugins.ecutest.report.atx.ATXPublisher.DescriptorImpl;

/**
* Main entry point to this plugin for the {@link Jenkins} instance.
*
@@ -188,4 +190,17 @@ public static ToolVersion parse(final String version) throws IllegalArgumentExce
return new ToolVersion(major, minor, micro, qualifier);
}
}

@Override
public void postInitialize() throws Exception {
super.postInitialize();
final Jenkins instance = Jenkins.getInstance();
if (instance != null) {
// Synchronize current ATX configuration with the default one.
final DescriptorImpl descriptor = instance.getDescriptorByType(DescriptorImpl.class);
if (descriptor != null) {
descriptor.syncWithDefaultConfig();
}
}
}
}
@@ -237,7 +237,7 @@ public void performReport(final Run<?, ?> run, final FilePath workspace, final L
*/
private boolean publishReports(final ATXInstallation installation, final Run<?, ?> run,
final Launcher launcher, final TaskListener listener)
throws IOException, InterruptedException {
throws IOException, InterruptedException {
final TTConsoleLogger logger = new TTConsoleLogger(listener);
final boolean isUploadEnabled = isUploadEnabled(installation);
final boolean isServerReachable = isServerReachable(installation, launcher, run.getEnvironment(listener));
@@ -373,15 +373,13 @@ public String getUrlName() {
private final transient ATXValidator atxValidator;

/**
* Instantiates a new {@link DescriptorImpl} and synchronizes
* the current ATX configuration with the default one.
* Instantiates a new {@link DescriptorImpl}.
*/
public DescriptorImpl() {
super();
load();
atxValidator = new ATXValidator();
defaultConfig = new ATXConfig();
syncWithDefaultConfig();
}

/**
@@ -461,9 +459,12 @@ public boolean configure(final StaplerRequest req, final JSONObject json) {
/**
* Synchronizes current ATX configuration with default configuration
* by overriding their current values and saving them as new ATX installation.
*
* This method will be automatically called by {@link ETPlugin#postInitialize()} to
* avoid circular dependencies while loading other plugins.
*/
@SuppressWarnings("unchecked")
private void syncWithDefaultConfig() {
public void syncWithDefaultConfig() {
final List<ATXInstallation> list = new ArrayList<ATXInstallation>();
for (final ATXInstallation installation : installations.clone()) {
final ATXConfig currentConfig = installation.getConfig();

0 comments on commit 5313443

Please sign in to comment.