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

ASF GitHub Bot commented on JAMES-1840:
---------------------------------------

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

    https://github.com/apache/james-project/pull/117#discussion_r193856233
  
    --- Diff: 
mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultUserQuotaRootResolver.java
 ---
    @@ -57,6 +57,7 @@ public QuotaRoot forUser(User user) {
         @Override
         public QuotaRoot getQuotaRoot(MailboxPath mailboxPath) {
             
Preconditions.checkArgument(!mailboxPath.getNamespace().contains(SEPARATOR), 
"Namespace should not contain " + SEPARATOR);
    +        Preconditions.checkArgument(mailboxPath.getUser() != null, 
"Username should not be null");
             
Preconditions.checkArgument(!mailboxPath.getUser().contains(SEPARATOR), 
"Username should not contain " + SEPARATOR);
             User user = User.fromUsername(mailboxPath.getUser());
    --- End diff --
    
    @chibenwa I think we should reconsider this task. If we accepting 
`MailboxPath#getUser()` as `null` we'll receive `NullPointerException` here.


> 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
(v7.6.3#76005)

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

Reply via email to