mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
implemented a fix for the data-loss problem.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1216 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
85bfd2ae45
commit
b46bf8b2b4
8 files changed
+22
-4
No files matched your search
@@ -43,6 +43,13 @@ import java.util.logging.Logger;
|
||||
* <p>
|
||||
* {@link Descriptor} also usually have its associated views.
|
||||
*
|
||||
*
|
||||
* <h2>Persistence</h2>
|
||||
* <p>
|
||||
* {@link Descriptor} can persist data just by storing them in fields.
|
||||
* However, it is the responsibility of the derived type to properly
|
||||
* invoke {@link #save()} and {@link #load()}.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see Describable
|
||||
*/
|
||||
@@ -63,7 +70,9 @@ public abstract class Descriptor<T extends Describable<T>> {
|
||||
|
||||
protected Descriptor(Class<? extends T> clazz) {
|
||||
this.clazz = clazz;
|
||||
load();
|
||||
// doing this turns out to be very error prone,
|
||||
// as field initializers in derived types will override values.
|
||||
// load();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +88,7 @@ public abstract class Descriptor<T extends Describable<T>> {
|
||||
* So there's no need to check that in the implementation.
|
||||
*
|
||||
* @param req
|
||||
* Always non-null. This object includes all the submitted form values.
|
||||
* Always non-null. This object includes all the submitted form values.
|
||||
*
|
||||
* @throws FormException
|
||||
* Signals a problem in the submitted form.
|
||||
@@ -141,8 +150,10 @@ public abstract class Descriptor<T extends Describable<T>> {
|
||||
}
|
||||
}
|
||||
|
||||
private void load() {
|
||||
// load
|
||||
/**
|
||||
* Loads the data from the disk into this object.
|
||||
*/
|
||||
protected synchronized void load() {
|
||||
XmlFile file = getConfigFile();
|
||||
if(!file.exists())
|
||||
return;
|
||||
|
||||
@@ -521,6 +521,7 @@ public class CVSSCM extends AbstractCVSFamilySCM {
|
||||
|
||||
DescriptorImpl() {
|
||||
super(CVSSCM.class);
|
||||
load();
|
||||
}
|
||||
|
||||
protected void convert(Map<String, Object> oldPropertyBag) {
|
||||
|
||||
@@ -417,6 +417,7 @@ public class SubversionSCM extends AbstractCVSFamilySCM {
|
||||
|
||||
DescriptorImpl() {
|
||||
super(SubversionSCM.class);
|
||||
load();
|
||||
}
|
||||
|
||||
protected void convert(Map<String, Object> oldPropertyBag) {
|
||||
|
||||
@@ -107,6 +107,7 @@ public class Ant extends Builder {
|
||||
|
||||
private DescriptorImpl() {
|
||||
super(Ant.class);
|
||||
load();
|
||||
}
|
||||
|
||||
protected void convert(Map<String,Object> oldPropertyBag) {
|
||||
|
||||
@@ -291,6 +291,7 @@ public class Mailer extends Publisher {
|
||||
|
||||
public DescriptorImpl() {
|
||||
super(Mailer.class);
|
||||
load();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -108,6 +108,7 @@ public class Maven extends Builder {
|
||||
|
||||
private DescriptorImpl() {
|
||||
super(Maven.class);
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ public class Shell extends Builder {
|
||||
|
||||
private DescriptorImpl() {
|
||||
super(Shell.class);
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ public class SCMTrigger extends Trigger {
|
||||
|
||||
DescriptorImpl() {
|
||||
super(SCMTrigger.class);
|
||||
load();
|
||||
// create an executor
|
||||
update();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user