Tidy up of UserTransaction roll back on throwable as opposed to Exception

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2218 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2006-01-26 15:38:58 +00:00
parent 90d70c6794
commit aa831ddd85
3 changed files with 76 additions and 29 deletions

View File

@@ -40,6 +40,8 @@ import org.alfresco.service.transaction.TransactionService;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.sun.star.uno.RuntimeException;
/** /**
* Alfresco Authenticator Class * Alfresco Authenticator Class
* *
@@ -351,7 +353,7 @@ public class AlfrescoAuthenticator extends SrvAuthenticator
client.setHomeFolder( homeSpaceRef); client.setHomeFolder( homeSpaceRef);
tx.commit(); tx.commit();
} }
catch (Exception ex) catch (Throwable ex)
{ {
try try
{ {
@@ -359,7 +361,16 @@ public class AlfrescoAuthenticator extends SrvAuthenticator
} }
catch (Exception ex2) catch (Exception ex2)
{ {
logger.error("Failed to rollback transaction", ex); logger.error("Failed to rollback transaction", ex2);
}
if(ex instanceof RuntimeException)
{
throw (RuntimeException)ex;
}
else
{
throw new RuntimeException("Failed to get home folder", ex);
} }
} }
} }

View File

@@ -135,7 +135,11 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
sp.addStore(getUserStoreRef()); sp.addStore(getUserStoreRef());
sp.excludeDataInTheCurrentTransaction(false); sp.excludeDataInTheCurrentTransaction(false);
ResultSet rs = searchService.query(sp); ResultSet rs = null;
try
{
rs = searchService.query(sp);
for (ResultSetRow row : rs) for (ResultSetRow row : rs)
{ {
@@ -151,6 +155,14 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
} }
} }
} }
}
finally
{
if (rs != null)
{
rs.close();
}
}
return null; return null;
} }

View File

@@ -134,7 +134,11 @@ public class PersonServiceImpl implements PersonService
sp.addStore(storeRef); sp.addStore(storeRef);
sp.excludeDataInTheCurrentTransaction(false); sp.excludeDataInTheCurrentTransaction(false);
ResultSet rs = searchService.query(sp); ResultSet rs = null;
try
{
rs = searchService.query(sp);
for (ResultSetRow row : rs) for (ResultSetRow row : rs)
{ {
@@ -151,6 +155,14 @@ public class PersonServiceImpl implements PersonService
} }
} }
} }
}
finally
{
if (rs != null)
{
rs.close();
}
}
return null; return null;
} }
@@ -283,13 +295,18 @@ public class PersonServiceImpl implements PersonService
{ {
SearchParameters sp = new SearchParameters(); SearchParameters sp = new SearchParameters();
sp.setLanguage(SearchService.LANGUAGE_LUCENE); sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery("TYPE:\"" + ContentModel.TYPE_PERSON+"\""); sp.setQuery("TYPE:\"" + ContentModel.TYPE_PERSON + "\"");
sp.addStore(storeRef); sp.addStore(storeRef);
sp.excludeDataInTheCurrentTransaction(false); sp.excludeDataInTheCurrentTransaction(false);
ResultSet rs = searchService.query(sp);
HashSet<NodeRef> nodes = new HashSet<NodeRef>(); HashSet<NodeRef> nodes = new HashSet<NodeRef>();
ResultSet rs = null;
try
{
rs = searchService.query(sp);
for (ResultSetRow row : rs) for (ResultSetRow row : rs)
{ {
@@ -299,7 +316,14 @@ public class PersonServiceImpl implements PersonService
nodes.add(nodeRef); nodes.add(nodeRef);
} }
} }
}
finally
{
if (rs != null)
{
rs.close();
}
}
return nodes; return nodes;
} }