[FIXED JENKINS-9367] persistence problem in View$PropertyList

This commit is contained in:
Kohsuke Kawaguchi committed 2011-04-18 09:42:18 -07:00
1 parent eb7292e1a2
commit dfc2fe3895
4 files changed
+31 -9

No files matched your search

@@ -91,7 +91,8 @@ public class ListView extends View implements Saveable {
this.owner = owner;
}
private Object readResolve() {
protected Object readResolve() {
super.readResolve();
if(includeRegex!=null)
includePattern = Pattern.compile(includeRegex);
initColumns();
+16 -7
View File
@@ -118,7 +118,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
* List of {@link ViewProperty}s configured for this view.
* @since 1.406
*/
private volatile DescribableList<ViewProperty,ViewPropertyDescriptor> properties = new PropertyList();
private volatile DescribableList<ViewProperty,ViewPropertyDescriptor> properties = new PropertyList(this);
protected View(String name) {
this.name = name;
@@ -129,9 +129,11 @@ public abstract class View extends AbstractModelObject implements AccessControll
this.owner = owner;
}
private Object readResolve() {
protected Object readResolve() {
if (properties == null) {
properties = new PropertyList();
properties = new PropertyList(this);
} else {
properties.setOwner(this);
}
return this;
}
@@ -762,15 +764,22 @@ public abstract class View extends AbstractModelObject implements AccessControll
return v;
}
private class PropertyList extends DescribableList<ViewProperty,ViewPropertyDescriptor> {
private PropertyList() {
super(View.this);
public static class PropertyList extends DescribableList<ViewProperty,ViewPropertyDescriptor> {
private PropertyList(View owner) {
super(owner);
}
public PropertyList() {// needed for XStream deserialization
}
public View getOwner() {
return (View)owner;
}
@Override
protected void onModified() throws IOException {
for (ViewProperty p : this)
p.setView(View.this);
p.setView(getOwner());
}
}
}