提交 6c54eb24 编写于 作者: K kohsuke

bug fix.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@4943 71c3de6d-444a-0410-be80-ed276b4c234a
上级 9d3f6dc0
......@@ -701,7 +701,7 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node
protected Collection<Computer> all() { return computers.values(); }
})
.add(new CollectionSearchIndex() {// for users
protected User get(String key) { return getUser(key); }
protected User get(String key) { return User.get(key,false); }
protected Collection<User> all() { return User.getAll(); }
})
.add(new CollectionSearchIndex() {// for views
......
......@@ -159,17 +159,14 @@ public class User extends AbstractModelObject {
return get("unknown");
}
/**
* Gets the {@link User} object by its id.
*/
public static User get(String id) {
public static User get(String id, boolean create) {
if(id==null)
return null;
id = id.replace('\\', '_').replace('/', '_');
synchronized(byName) {
User u = byName.get(id);
if(u==null) {
if(u==null && create) {
u = new User(id);
byName.put(id,u);
}
......@@ -177,6 +174,13 @@ public class User extends AbstractModelObject {
}
}
/**
* Gets the {@link User} object by its id.
*/
public static User get(String id) {
return get(id,true);
}
/**
* Gets all the users.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册