Bug 40720 - Adding groups to a user throws an error
Summary: Adding groups to a user throws an error
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Webapps:Administration (show other bugs)
Version: 5.5.17
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
: 41490 (view as bug list)
Depends on:
Reported: 2006-10-11 00:54 UTC by Johan C. St
Modified: 2007-01-29 20:46 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Johan C. St 2006-10-11 00:54:49 UTC
Error is caused by the fact that somehow the group looked for is surrouded by "" so looking for group1 
"group1" is searched for.

Simpel solution I added in org.apache.catalina.mbeans.UserMBean is the removal of " from the 
groupname when searching for it.

    public void addGroup(String groupname) {

        User user = (User) this.resource;
        if (user == null) {
        String lookupGroupname = groupname.replaceAll("\"", "");
        Group group = user.getUserDatabase().findGroup(lookupGroupname);
        if (group == null) {
            throw new IllegalArgumentException
                ("Invalid group name '" + lookupGroupname + "'");


the only change I made is the adding of replaceAll 

Sorry for not making a proper patch file but I don't know how to do it. Hope you can implement this 
solution so adding of groups to a user works.
Comment 1 Mark Thomas 2006-11-18 19:42:37 UTC
Thanks for the report. This has been fixed in SVN and will be included in 5.5.21
Comment 2 Mark Thomas 2007-01-29 20:46:44 UTC
*** Bug 41490 has been marked as a duplicate of this bug. ***