提交 462e533a 编写于 作者: K kohsuke

fixed #165.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1149 71c3de6d-444a-0410-be80-ed276b4c234a
上级 2c6a3afd
......@@ -3,6 +3,7 @@ package hudson.model;
import com.thoughtworks.xstream.XStream;
import hudson.FeedAdapter;
import hudson.XmlFile;
import hudson.CopyOnWrite;
import hudson.model.Descriptor.FormException;
import hudson.scm.ChangeLogSet;
import hudson.util.RunList;
......@@ -37,8 +38,8 @@ public class User extends AbstractModelObject {
/**
* List of {@link UserProperty}s configured for this project.
* Copy-on-write semantics.
*/
@CopyOnWrite
private volatile List<UserProperty> properties = new ArrayList<UserProperty>();
......@@ -46,12 +47,6 @@ public class User extends AbstractModelObject {
this.id = id;
this.fullName = id; // fullName defaults to name
for (UserPropertyDescriptor d : UserProperties.LIST) {
UserProperty up = d.newInstance(this);
if(up!=null)
properties.add(up);
}
// load the other data from disk if it's available
XmlFile config = getConfigFile();
try {
......@@ -61,6 +56,16 @@ public class User extends AbstractModelObject {
LOGGER.log(Level.SEVERE, "Failed to load "+config,e);
}
// allocate default instances if needed.
// doing so after load makes sure that newly added user properties do get reflected
for (UserPropertyDescriptor d : UserProperties.LIST) {
if(getProperty(d.clazz)==null) {
UserProperty up = d.newInstance(this);
if(up!=null)
properties.add(up);
}
}
for (UserProperty p : properties)
p.setUser(this);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册