james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <server-...@james.apache.org>
Subject [jira] [Commented] (JAMES-1840) NPE on quota update when performed with null user
Date Thu, 07 Jun 2018 01:50:00 GMT

    [ https://issues.apache.org/jira/browse/JAMES-1840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16504141#comment-16504141

ASF GitHub Bot commented on JAMES-1840:

Github user chibenwa commented on a diff in the pull request:

    --- Diff: mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultQuotaRootResolver.java
    @@ -55,6 +55,7 @@ public QuotaRoot createQuotaRoot(String quotaRootValue) {
         public QuotaRoot getQuotaRoot(MailboxPath mailboxPath) throws MailboxException {
"Namespace should not contain " + SEPARATOR);
    +        Preconditions.checkArgument(mailboxPath.getUser() != null, "Username should not
be null");
    --- End diff --
    Hi Edgar.
    Thank you very much for your contribution.
    However, I don't think solving this issue is that easy... `null` user of a mailboxpath
had been used for shared folders thus I think we should consider it as valid.
    What would you thing of this:
    MailboxPath("#namespace", "user", "any) -> QuotaRoot will be "#namespace&user"
    MailboxPath("#namespace",  null, "any) -> QuotaRoot will be "#namespace"
    (We just ignore the user part of the quota root when none).
    Of course, we would need to better represent the fact that a mailbox path might not have
a user (by using Optional?) but that is a long refactoring on a central object that would
introduce API breaking changes, hence the former solution seems better to me.
    Best regards,

> NPE on quota update when performed with null user
> -------------------------------------------------
>                 Key: JAMES-1840
>                 URL: https://issues.apache.org/jira/browse/JAMES-1840
>             Project: James Server
>          Issue Type: Bug
>          Components: mailbox
>            Reporter: Tellier Benoit
>            Priority: Major
>              Labels: easyfix
> When using a null user on a mailbox path...
> {code:java}
> java.lang.NullPointerException: null
> 	at
> DefaultQuotaRootResolver.getQuotaRoot(DefaultQuotaRootResolver.java:58)
> 	at
> ListeningCurrentQuotaUpdater.event(ListeningCurrentQuotaUpdater.java:59)
> 	at createMailbox(StoreMailboxManager.java:474)
> {code}
> Answer *DefaultQuotaRootResolver* accepts mailboxPaths with null users. Also add test
cases regarding this in *DefaultQuotaRootResolverTest*.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org

View raw message