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

Benoit Tellier commented on JAMES-3709:
---------------------------------------

Good to know.

I would personnally prefer not to rely on `null` in Mailbox::getMessage 
(ambiguous meaning, callers can forget to handle the missing case) and prefer 
using an `Optional<InputSream>` instead (epesses the fact that the value is 
missing, the caller is forced to handle the missing case.). While we are 
refactoring this part of the code, this would definitly make it stronger.

> Missing null check in POP3 TopCmdHandler
> ----------------------------------------
>
>                 Key: JAMES-3709
>                 URL: https://issues.apache.org/jira/browse/JAMES-3709
>             Project: James Server
>          Issue Type: Bug
>          Components: protocols
>    Affects Versions: master
>            Reporter: Karsten Otto
>            Priority: Major
>         Attachments: error.txt
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> TopCmdHandler is missing a null check when retrieving the message content, 
> i.e. the InputStream can be null, which results in an NPE down the line. 
> Admittedly this is a rare case, I only observed this during heavy load 
> testing.
> On closer inspection it turns out that TopCmdHandler duplicates a major 
> portion of code from RetrCmdHandler, but with subtle differences such as the 
> null check mentioned above.
> I propose to refactor the two classes to make them share the code, and 
> provide unit tests for all possible error/success cases.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to