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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]