Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIX JENKINS-41535] Fix persistence of nodejs installation tool invok…
…ing load and save methods.
  • Loading branch information
nfalco79 committed Feb 3, 2017
1 parent ccedc5f commit a15909a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java
Expand Up @@ -23,8 +23,10 @@

import jenkins.plugins.nodejs.Messages;
import jenkins.security.MasterToSlaveCallable;
import net.sf.json.JSONObject;

import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

/**
* Information about JDK installation.
Expand Down Expand Up @@ -114,6 +116,11 @@ private String getBin() {
@Extension
public static class DescriptorImpl extends ToolDescriptor<NodeJSInstallation> {

public DescriptorImpl() {
// load installations at Jenkins startup
load();
}

@Override
public String getDisplayName() {
return Messages.NodeJSInstallation_displayName();
Expand All @@ -124,6 +131,22 @@ public List<? extends ToolInstaller> getDefaultInstallers() {
return Collections.singletonList(new NodeJSInstaller(null, null, 72));
}

/*
* (non-Javadoc)
* @see hudson.tools.Descriptor#configure(org.kohsuke.stapler.StaplerRequest, net.sf.json.JSONObject)
*/
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException {
boolean result = super.configure(req, json);
/*
* Invoked when the global configuration page is submitted. If
* installation are modified programmatically than it's a developer
* task perform the call to save method on this descriptor.
*/
save();
return result;
}

}

}

0 comments on commit a15909a

Please sign in to comment.