You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2009/01/09 16:20:59 UTC

[jira] Updated: (JCR-1823) Repository.login throws IllegalStateException

     [ https://issues.apache.org/jira/browse/JCR-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1823:
-------------------------------

    Attachment: JCR-1823.patch

How about this alternative patch that makes sanityCheck() directly throw a RepositoryException? This way we don't need to explicitly catch and rethrow the exception.

Note that I also removed the sanityCheck() call from a few protected getter methods. Public methods that cause those getters to be invoked have already called sanityCheck, so it's safe to drop these extra calls.

> 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
>         Attachments: JCR-1823.patch
>
>
> 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.