MAILBOX-372 PropagateLookupRightListener should not catch exceptions

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/369d4db6
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/369d4db6
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/369d4db6

Branch: refs/heads/master
Commit: 369d4db65db1d39978955dd5316dbf9a808180f0
Parents: ce2036f
Author: Benoit Tellier <[email protected]>
Authored: Wed Jan 16 11:50:28 2019 +0700
Committer: Benoit Tellier <[email protected]>
Committed: Thu Jan 17 18:01:13 2019 +0700

----------------------------------------------------------------------
 .../event/PropagateLookupRightListener.java     | 30 +++++++-------------
 1 file changed, 11 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/369d4db6/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
 
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
index 2ab0273..d56b616 100644
--- 
a/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
+++ 
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
@@ -59,30 +59,22 @@ public class PropagateLookupRightListener implements 
MailboxListener.GroupMailbo
     }
 
     @Override
-    public void event(Event event) {
-        try {
-            MailboxSession mailboxSession = createMailboxSession(event);
+    public void event(Event event) throws MailboxException {
+        MailboxSession mailboxSession = createMailboxSession(event);
 
-            if (event instanceof MailboxACLUpdated) {
-                MailboxACLUpdated aclUpdateEvent = (MailboxACLUpdated) event;
-                MailboxPath mailboxPath = 
mailboxManager.getMailbox(aclUpdateEvent.getMailboxId(), 
mailboxSession).getMailboxPath();
+        if (event instanceof MailboxACLUpdated) {
+            MailboxACLUpdated aclUpdateEvent = (MailboxACLUpdated) event;
+            MailboxPath mailboxPath = 
mailboxManager.getMailbox(aclUpdateEvent.getMailboxId(), 
mailboxSession).getMailboxPath();
 
-                updateLookupRightOnParent(mailboxSession, mailboxPath, 
aclUpdateEvent.getAclDiff());
-            } else if (event instanceof MailboxRenamed) {
-                MailboxRenamed renamedEvent = (MailboxRenamed) event;
-                updateLookupRightOnParent(mailboxSession, 
renamedEvent.getNewPath());
-            }
-        } catch (MailboxException e) {
-            throw new RuntimeException(e);
+            updateLookupRightOnParent(mailboxSession, mailboxPath, 
aclUpdateEvent.getAclDiff());
+        } else if (event instanceof MailboxRenamed) {
+            MailboxRenamed renamedEvent = (MailboxRenamed) event;
+            updateLookupRightOnParent(mailboxSession, 
renamedEvent.getNewPath());
         }
     }
 
-    private MailboxSession createMailboxSession(Event event) {
-        try {
-            return 
mailboxManager.createSystemSession(event.getUser().asString());
-        } catch (MailboxException e) {
-            throw new RuntimeException("unable to create system session of 
user:" + event.getUser().toString(), e);
-        }
+    private MailboxSession createMailboxSession(Event event) throws 
MailboxException {
+        return mailboxManager.createSystemSession(event.getUser().asString());
     }
 
     private void updateLookupRightOnParent(MailboxSession session, MailboxPath 
path) throws MailboxException {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to