You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rc...@apache.org on 2020/05/05 01:48:34 UTC
[james-project] branch master updated: MAILBOX-397 Mapper
generation should not throw
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push:
new 876561b MAILBOX-397 Mapper generation should not throw
876561b is described below
commit 876561b93ff5807420781cce553cc71b43f7b026
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon May 4 17:53:35 2020 +0700
MAILBOX-397 Mapper generation should not throw
---
.../james/mailbox/store/StoreMessageIdManager.java | 20 ++++++++------------
.../james/mailbox/store/StoreRightManager.java | 10 +++-------
2 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
index 707924a..3f87736 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
@@ -145,18 +145,14 @@ public class StoreMessageIdManager implements MessageIdManager {
@Override
public Flux<MessageResult> getMessagesReactive(Collection<MessageId> messageIds, FetchGroup fetchGroup, MailboxSession mailboxSession) {
- try {
- MessageIdMapper messageIdMapper = mailboxSessionMapperFactory.getMessageIdMapper(mailboxSession);
-
- MessageMapper.FetchType fetchType = FetchGroupConverter.getFetchType(fetchGroup);
- return messageIdMapper.findReactive(messageIds, fetchType)
- .groupBy(MailboxMessage::getMailboxId)
- .filterWhen(groupedFlux -> hasRightsOnMailboxReactive(mailboxSession, Right.Read).apply(groupedFlux.key()))
- .flatMap(Function.identity())
- .map(Throwing.function(messageResultConverter(fetchGroup)).sneakyThrow());
- } catch (MailboxException e) {
- return Flux.error(e);
- }
+ MessageIdMapper messageIdMapper = mailboxSessionMapperFactory.getMessageIdMapper(mailboxSession);
+
+ MessageMapper.FetchType fetchType = FetchGroupConverter.getFetchType(fetchGroup);
+ return messageIdMapper.findReactive(messageIds, fetchType)
+ .groupBy(MailboxMessage::getMailboxId)
+ .filterWhen(groupedFlux -> hasRightsOnMailboxReactive(mailboxSession, Right.Read).apply(groupedFlux.key()))
+ .flatMap(Function.identity())
+ .map(Throwing.function(messageResultConverter(fetchGroup)).sneakyThrow());
}
private ImmutableSet<MailboxId> getAllowedMailboxIds(MailboxSession mailboxSession, List<MailboxMessage> messageList, Right... rights) {
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java
index 1d33f99..20f4779 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java
@@ -104,13 +104,9 @@ public class StoreRightManager implements RightManager {
@Override
public Mono<Rfc4314Rights> myRightsReactive(MailboxId mailboxId, MailboxSession session) {
- try {
- MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
- return mapper.findMailboxByIdReactive(mailboxId)
- .map(Throwing.function(mailbox -> myRights(mailbox, session)));
- } catch (MailboxException e) {
- return Mono.error(e);
- }
+ MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
+ return mapper.findMailboxByIdReactive(mailboxId)
+ .map(Throwing.function(mailbox -> myRights(mailbox, session)));
}
public Rfc4314Rights myRights(Mailbox mailbox, MailboxSession session) throws UnsupportedRightException {
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org