creating new account with same username/eid does not return error in HSQLDB

Description

If running on HSQLDB and you create a new user with a username/eid that already exists, you do not receive any error onscreen so you don't know what happened, but you get an SQLException in the logs.

.....
Caused by: java.sql.SQLException: Violation of unique index AK_SAKAI_USER_ID_MAP_EID: duplicate value(s) for column(s) EID in statement [insert into SAKAI_USER_ID_MAP (USER_ID, EID) values (?,?)]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)

if running on MySQL, the exception is caught as expected and you receive the "Alert: The user id is already in use"

This is because UsersAction.java only catches specific Exceptions, which must not be being thrown properly in HSQLDB

try
{
// add the user in one step so that all you need is add not update permission
// (the added might be "anon", and anon has add but not update permission)
User newUser = UserDirectoryService.addUser(id, eid, firstName, lastName, email, pw, type, null);

// put the user in the state
state.setAttribute("newuser", newUser);
}
catch (UserAlreadyDefinedException e)
{
addAlert(state, rb.getString("useact.theuseid1"));
return false;
}
catch (UserIdInvalidException e)
{
addAlert(state, rb.getString("useact.theuseid2"));
return false;
}
catch (UserPermissionException e)
{
addAlert(state, rb.getString("useact.youdonot3"));
return false;
}

Perhaps a generic catch at the end to catch any other exceptions or modify UserDirectoryService.addUser() so it throws the correct exception in HSQLDB

Attachments

1

Activity

Show:

David Horwitz February 13, 2010 at 2:33 AM

MAINT TEAM REVIEW: This is fixed by a linked kernel issue for all versions 2.6 and later

Steve Swinsburg January 28, 2010 at 3:49 AM

Unassigning as I am unable to work on this at the moment.

Steve Swinsburg January 28, 2010 at 3:49 AM

I think this is ok to be fixed in 2.5.x but have not verified.

Steve Swinsburg March 2, 2009 at 1:11 PM

This is fixed via - since we have no real trunk for anything below 2.6 are we ok to just patch, test locally and merge to the 2.5 (and 2.4) branches?

Matthew Buckett February 17, 2009 at 7:39 AM

I think this bug also exists in the kernel.

Duplicate

Details

Priority

Components

Assignee

Reporter

Created January 22, 2009 at 5:20 AM
Updated February 13, 2010 at 2:33 AM
Resolved February 13, 2010 at 2:33 AM