rem: if (cocoon.request.get("remove_group") && userGroupId != "") { 
add: if (cocoon.request.get("remove_group") && userGroupId != null) { 
context: function user_change_groups(userId) {	resolve();	try {		var groupManager = getAccreditableManager().getGroupManager();	    var user = getAccreditableManager().getUserManager().getUser(userId);	    	    var userGroupArray = user.getGroups();	    var userGroups = new java.util.ArrayList(java.util.Arrays.asList(userGroupArray));	    	    var groupArray = getAccreditableManager().getGroupManager().getGroups();	    var groups = new java.util.ArrayList(java.util.Arrays.asList(groupArray));	    	    while (true) {		    cocoon.sendPageAndWait("users/" + userId + "/groups.xml", {		    	"user-id" : userId,		    	"groups" : groups,		    	"user-groups" : userGroups		    });		    			var groupId = cocoon.request.get("group");			if (cocoon.request.get("add_group") && groupId != "") {				var group = groupManager.getGroup(groupId);				if (!userGroups.contains(group)) {					userGroups.add(group);					groups.remove(group);				}			}		    			var userGroupId = cocoon.request.get("user_group");			if (cocoon.request.get("remove_group") && userGroupId != "") {				var group = groupManager.getGroup(userGroupId);				if (userGroups.contains(group)) {					userGroups.remove(group);					groups.add(group);				}			}			    if (cocoon.request.get("cancel")) {		    	break;		    }		    			if (cocoon.request.get("submit")) {				user.removeFromAllGroups();				var iterator = userGroups.iterator();				while (iterator.hasNext()) {					var group = iterator.next();					group.add(user);				}				user.save();				break;			}		}	   	cocoon.sendPage("redirect.html", { "url" : "index.html" });   	}   	finally {   		release();   	}}
meta: 791	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/791/910cb4d4f662d1bd23d00201f18c580c89c5bc16/user-admin.js/buggy/src/webapp/lenya/content/admin/users/user-admin.js