james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <mime4j-...@james.apache.org>
Subject [jira] [Commented] (MIME4J-276) Potential NPE in Fields.contentType(String mimeType, NameValuePair... parameters)
Date Thu, 17 May 2018 10:07:00 GMT

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

Oleg Kalnichevski commented on MIME4J-276:
------------------------------------------

[~dma_k] Yes, most likely I messed up. It was likely meant to be
{code:java}
public static ContentTypeField contentType(String mimeType, NameValuePair... parameters) {
    return contentType(mimeType, parameters != null && parameters.length > 0 ?
Arrays.asList(parameters) : null);
}
{code}
Oleg

> Potential NPE in Fields.contentType(String mimeType, NameValuePair... parameters)
> ---------------------------------------------------------------------------------
>
>                 Key: MIME4J-276
>                 URL: https://issues.apache.org/jira/browse/MIME4J-276
>             Project: James Mime4j
>          Issue Type: Bug
>          Components: dom
>    Affects Versions: 0.8.2
>            Reporter: Dmitry Katsubo
>            Priority: Minor
>
> The code of this method reads:
> {code}
> public static ContentTypeField contentType(String mimeType, NameValuePair... parameters)
{
>     return contentType(mimeType, parameters != null || parameters.length == 0 ? Arrays.asList(parameters)
: null);
> }
> {code}
> Eclipse shows an error at location {{parameters.length == 0}} because at this place {{parameters}}
can only be NULL. Perhaps the author ([~olegk]) meant this:
> {code}
> parameters == null || parameters.length == 0 ? null : Arrays.asList(parameters)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message