Repository.login throws IllegalStateException
---------------------------------------------

                 Key: JCR-1823
                 URL: https://issues.apache.org/jira/browse/JCR-1823
             Project: Jackrabbit
          Issue Type: Bug
          Components: jackrabbit-core
    Affects Versions: core 1.4.5
            Reporter: Felix Meschberger


Calling any login method on Repository instance, which has been shut down 
throws an IllegalStateException, which is caused by the 
RepositoryImpl.sanityCheck method.

This exception is unexpected by callers of the login method, which is specified 
to throw one of LoginException, NoSuchWorkspaceException and 
RepositoryException. In particular the spec says, that a RepositoryException is 
thrown "if another error occurs".

So I suggest to modify the RepositoryImpl.login(Credentials, String) as follows 
(patch against trunk):

Index: 
/usr/src/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
===================================================================
--- 
/usr/src/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
      (revision 706543)
+++ 
/usr/src/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
      (working copy)
@@ -1358,6 +1358,8 @@
         } catch (AccessDeniedException ade) {
             // authenticated subject is not authorized for the specified 
workspace
             throw new LoginException("Workspace access denied", ade);
+        } catch (RuntimeException re) {
+            throw new RepositoryException(re.getMessage(), re);
         } finally {
             shutdownLock.readLock().release();
         }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to