You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2008/10/21 09:19:44 UTC

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

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.


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

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663737#action_12663737 ] 

Jukka Zitting commented on JCR-1823:
------------------------------------

Merged also to the 1.4 branch in revision 734370.

> Repository.login throws IllegalStateException
> ---------------------------------------------
>
>                 Key: JCR-1823
>                 URL: https://issues.apache.org/jira/browse/JCR-1823
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: core 1.4.5
>            Reporter: Felix Meschberger
>            Assignee: Jukka Zitting
>             Fix For: 1.5.1, core 1.4.7
>
>         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.


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

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641304#action_12641304 ] 

Alexander Klimetschek commented on JCR-1823:
--------------------------------------------

+1

> 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.


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

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting resolved JCR-1823.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.1
         Assignee: Jukka Zitting

Patch applied in revision 733080. Targeting for 1.5.1.

> 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
>            Assignee: Jukka Zitting
>             Fix For: 1.5.1
>
>         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.


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

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "Grégory Joseph (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662990#action_12662990 ] 

Grégory Joseph commented on JCR-1823:
-------------------------------------

I might be wrong, but I seem to remember this is the exception i got with JCR-1778, which might thus be irrelevant now ?

> 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
>            Assignee: Jukka Zitting
>             Fix For: 1.5.1
>
>         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.


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

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651561#action_12651561 ] 

Jukka Zitting commented on JCR-1823:
------------------------------------

+1

> 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.


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

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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

    Fix Version/s: core 1.4.7

> Repository.login throws IllegalStateException
> ---------------------------------------------
>
>                 Key: JCR-1823
>                 URL: https://issues.apache.org/jira/browse/JCR-1823
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: core 1.4.5
>            Reporter: Felix Meschberger
>            Assignee: Jukka Zitting
>             Fix For: 1.5.1, core 1.4.7
>
>         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.


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

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662400#action_12662400 ] 

Felix Meschberger commented on JCR-1823:
----------------------------------------

Looks good to me, too, and makes perfect sense.

> 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.