Fix AR-730

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3317 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana 2006-07-13 10:42:46 +00:00
parent 623a4d8420
commit b837029c1c
2 changed files with 43 additions and 9 deletions

View File

@ -645,19 +645,29 @@ public class SessionImpl implements Session
if (isLive())
{
// invalidate authentication
getRepositoryImpl().getServiceRegistry().getAuthenticationService().invalidateTicket(getTicket());
ticket = null;
// clean up resources
try
{
sessionIsolation.rollback();
try
{
getRepositoryImpl().getServiceRegistry().getAuthenticationService().invalidateTicket(getTicket());
}
finally
{
try
{
sessionIsolation.rollback();
}
catch(RepositoryException e)
{
// continue execution and force logout
}
}
}
catch(RepositoryException e)
finally
{
// force logout
ticket = null;
repository.deregisterSession();
}
repository.deregisterSession();
}
}

View File

@ -94,5 +94,29 @@ public class SessionImplTest extends BaseJCRTest
assertFalse(isLive);
}
public void testSessionThread()
{
SimpleCredentials superuser = new SimpleCredentials("superuser", "".toCharArray());
try
{
Session anotherSession = repository.login(superuser, getWorkspace());
fail("Exception not thrown when establishing two sessions on same thread");
}
catch(RepositoryException e)
{
// successful - multiple sessions on one thread caught
}
superuserSession.logout();
try
{
Session anotherSession = repository.login(superuser, getWorkspace());
anotherSession.logout();
}
catch(RepositoryException e)
{
fail("Exception thrown when it shouldn't of been.");
}
}
}