Issue Details (XML | Word | Printable)

Key: LPS-1797
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Douglas Wong
Reporter: Artur Linhart (BC)
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
PUBLIC - Liferay Portal Standard Edition

Error in UserLocalServiceImpl.addUser - if the default communities (groups) are specified badly the exception is thrown and the user is not initialized properly

Created: 27/Jan/09 06:11 AM   Updated: 02/Feb/09 02:06 PM
Component/s: None
Affects Version/s: 5.1.2
Fix Version/s: None

Time Tracking:
Not Specified

Environment: 5.1.2 Tomcat6.0.16, postgresql (but is environment independent)

Rank:
1678     


 Description  « Hide
In the addUser method there is following code containing error:

// Default groups

String[] defaultGroupNames = PrefsPropsUtil.getStringArray(
companyId, PropsKeys.ADMIN_DEFAULT_GROUP_NAMES, StringPool.NEW_LINE,
PropsValues.ADMIN_DEFAULT_GROUP_NAMES);

long[] groupIds = new long[defaultGroupNames.length];

for (int i = 0; i < defaultGroupNames.length; i++) {
try {
Group group = groupFinder.findByC_N(
companyId, defaultGroupNames[i]);

groupIds[i] = group.getGroupId();
}
catch (NoSuchGroupException nsge) {
}
}

groupLocalService.addUserGroups(userId, groupIds);

.
In teh case at least one default Group (default community specified in the Enterprise Admin Portlet) does not exist, then the array will be generated, whcih contains at least one group Id (array item) equal to 0. The the method
groupLocalService.addUserGroups(userId, groupIds);
throws an exeption "Group Id with Id 0 does ot exist" and the rest of the method is skipped - there are initialized no roles, no user groups, no default webs, no e-mail is sent.

The solutio is simple - instead of usig array use List, like by the roles and user groups.

 All   Comments   Work Log   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Artur Linhart (BC) added a comment - 27/Jan/09 06:21 AM - Visible to
Under some circumstances it is possible the user cannot be inserted at all...

Artur Linhart (BC) added a comment - 27/Jan/09 06:21 AM
... if the default groups are specified incorrectly :-)

Douglas Wong added a comment - 28/Jan/09 11:47 AM
The code was altered during task LEP-7564, which effectively solves this bug.

Artur Linhart (BC) added a comment - 30/Jan/09 11:59 PM - Visible to
Hello,

 does it mean this error will in the next versions not come even if the method adUser is called by some own defined portlet direct?

   thank You for information, Artur