提交 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 ...@@ -701,7 +701,7 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node
protected Collection<Computer> all() { return computers.values(); } protected Collection<Computer> all() { return computers.values(); }
}) })
.add(new CollectionSearchIndex() {// for users .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(); } protected Collection<User> all() { return User.getAll(); }
}) })
.add(new CollectionSearchIndex() {// for views .add(new CollectionSearchIndex() {// for views
......
...@@ -159,17 +159,14 @@ public class User extends AbstractModelObject { ...@@ -159,17 +159,14 @@ public class User extends AbstractModelObject {
return get("unknown"); return get("unknown");
} }
/** public static User get(String id, boolean create) {
* Gets the {@link User} object by its id.
*/
public static User get(String id) {
if(id==null) if(id==null)
return null; return null;
id = id.replace('\\', '_').replace('/', '_'); id = id.replace('\\', '_').replace('/', '_');
synchronized(byName) { synchronized(byName) {
User u = byName.get(id); User u = byName.get(id);
if(u==null) { if(u==null && create) {
u = new User(id); u = new User(id);
byName.put(id,u); byName.put(id,u);
} }
...@@ -177,6 +174,13 @@ public class User extends AbstractModelObject { ...@@ -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. * Gets all the users.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册