jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r507159 - /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
Date Tue, 13 Feb 2007 19:00:11 GMT
Author: reschke
Date: Tue Feb 13 11:00:10 2007
New Revision: 507159

URL: http://svn.apache.org/viewvc?view=rev&rev=507159
Log:
Avoid leaking SessionInfos.

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java?view=diff&rev=507159&r1=507158&r2=507159
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
Tue Feb 13 11:00:10 2007
@@ -72,10 +72,16 @@
     public Session login(Credentials credentials, String workspaceName) throws LoginException,
NoSuchWorkspaceException, RepositoryException {
         String wspName = (workspaceName == null) ? config.getDefaultWorkspaceName() : workspaceName;
         SessionInfo info = config.getRepositoryService().obtain(credentials, wspName);
-        if (info instanceof XASessionInfo) {
-            return new XASessionImpl((XASessionInfo) info, this, config);
-        } else {
-            return new SessionImpl(info, this, config);
+        try {
+            if (info instanceof XASessionInfo) {
+                return new XASessionImpl((XASessionInfo) info, this, config);
+            } else {
+                return new SessionImpl(info, this, config);
+            }
+        }
+        catch (RepositoryException ex) {
+            config.getRepositoryService().dispose(info);
+            throw ex;
         }
     }
 



Mime
View raw message