vttranlina commented on code in PR #2644:
URL: https://github.com/apache/james-project/pull/2644#discussion_r1961365563


##########
mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java:
##########
@@ -134,12 +135,15 @@ public Flux<Mailbox> list() {
 
     @Override
     public Mono<ACLDiff> updateACL(Mailbox mailbox, MailboxACL.ACLCommand 
mailboxACLCommand) {
-        return Mono.fromCallable(() -> {
-            MailboxACL oldACL = mailbox.getACL();
-            MailboxACL newACL = mailbox.getACL().apply(mailboxACLCommand);
-            
mailboxesByPath.get(mailbox.generateAssociatedPath()).setACL(newACL);
-            return ACLDiff.computeDiff(oldACL, newACL);
-        });
+        return Mono.just(mailbox.getACL())
+            .flatMap(oldACL -> Mono.fromCallable(() -> 
mailboxesByPath.compute(mailbox.generateAssociatedPath(), (path, 
existingMailbox) -> {
+                    if (existingMailbox == null) {
+                        throw new IllegalArgumentException("Mailbox not found 
for path: " + path);
+                    }
+                    Throwing.runnable(() -> 
existingMailbox.setACL(existingMailbox.getACL().apply(mailboxACLCommand))).run();

Review Comment:
   this function throw check exception (`UnsupportedRightException`)
   If use try-catch in lamda, it should still be wrapped in a RuntimeException.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to