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-2384) When there is no body, getting a NullPointerException
Date Wed, 02 May 2018 03:19:00 GMT

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

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

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

    https://github.com/apache/james-project/pull/112#discussion_r185384678
  
    --- Diff: mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessageTest.java
---
    @@ -0,0 +1,52 @@
    +/****************************************************************
    + * Licensed to the Apache Software Foundation (ASF) under one   *
    + * or more contributor license agreements.  See the NOTICE file *
    + * distributed with this work for additional information        *
    + * regarding copyright ownership.  The ASF licenses this file   *
    + * to you under the Apache License, Version 2.0 (the            *
    + * "License"); you may not use this file except in compliance   *
    + * with the License.  You may obtain a copy of the License at   *
    + *                                                              *
    + *   http://www.apache.org/licenses/LICENSE-2.0                 *
    + *                                                              *
    + * Unless required by applicable law or agreed to in writing,   *
    + * software distributed under the License is distributed on an  *
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
    + * KIND, either express or implied.  See the License for the    *
    + * specific language governing permissions and limitations      *
    + * under the License.                                           *
    + ****************************************************************/
    +package org.apache.james.mailbox.jpa.mail.model.openjpa;
    +
    +import java.lang.reflect.Field;
    +import java.nio.charset.StandardCharsets;
    +
    +import org.apache.commons.io.IOUtils;
    +import org.junit.Assert;
    +import org.junit.Test;
    +
    +public class JPAMailboxMessageTest {
    +
    +    /**
    +     * Even thought there should never be a null body, it does happen. See JAMES-2384
    +     * 
    +     * @throws Exception
    +     *             any exception
    +     */
    +    @Test
    +    public void testGetFullContent_nullBody() throws Exception {
    --- End diff --
    
    We tend to use a naming convention for our tests:
    
    ```
    [MethodName]Should[ExpectedResult]When[SpecificCondition]
    ```
    
    Here it would be:
    
    ```
    getFullContentShouldReturnOriginalContentWhenBodyFieldIsNull
    ```


> When there is no body, getting a NullPointerException
> -----------------------------------------------------
>
>                 Key: JAMES-2384
>                 URL: https://issues.apache.org/jira/browse/JAMES-2384
>             Project: James Server
>          Issue Type: Bug
>          Components: mailbox
>    Affects Versions: master
>            Reporter: Simon Levesque
>            Priority: Minor
>             Fix For: master
>
>
> h1. Steps to reproduce:
> Send an empty email:
> {noformat}
> msmtp --read-envelope-from a2@foilen-lab.com << _EOF
> from: a1@foilen-lab.com
> to: a2@foilen-lab.com
> subject: Empty from msmtp
> _EOF{noformat}
> This email is well sent by msmtp and accepted by James.
>  
> In the client, we can see the email (date, sender, subject), but when we want to see
the body, we are getting this exception since the "body" is null:
> {noformat}
> INFO | jvm 1 | 2018/04/23 22:56:59 | java.lang.NullPointerException
> INFO | jvm 1 | 2018/04/23 22:56:59 | at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:106)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.mailbox.jpa.mail.model.openjpa.JPAMailboxMessage.getBodyContent(JPAMailboxMessage.java:94)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.mailbox.jpa.mail.model.openjpa.AbstractJPAMailboxMessage.getFullContent(AbstractJPAMailboxMessage.java:477)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.mailbox.store.streaming.InputStreamContent.getInputStream(InputStreamContent.java:62)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.fetch.ContentBodyElement.getInputStream(ContentBodyElement.java:60)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imapserver.netty.ChannelImapResponseWriter.write(ChannelImapResponseWriter.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.ImapResponseComposerImpl.literal(ImapResponseComposerImpl.java:312)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.FetchResponseEncoder.encodeBodyElements(FetchResponseEncoder.java:271)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.FetchResponseEncoder.doEncode(FetchResponseEncoder.java:86)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:52)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.chainEncode(AbstractChainedImapEncoder.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.encode.base.AbstractChainedImapEncoder.encode(AbstractChainedImapEncoder.java:54)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.main.ResponseEncoder.respond(ResponseEncoder.java:47)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.fetch.FetchProcessor.processMessageRanges(FetchProcessor.java:167)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.fetch.FetchProcessor.doProcess(FetchProcessor.java:119)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.fetch.FetchProcessor.doProcess(FetchProcessor.java:1)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:110)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.AbstractMailboxProcessor.process(AbstractMailboxProcessor.java:97)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:89)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:1)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:59)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:68)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.apache.james.imapserver.netty.ImapChannelUpstreamHandler.messageReceived(ImapChannelUpstreamHandler.java:196)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(ChannelUpstreamEventRunnable.java:43)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:67)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.run(OrderedMemoryAwareThreadPoolExecutor.java:314)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> INFO | jvm 1 | 2018/04/23 22:56:59 | at java.lang.Thread.run(Thread.java:748){noformat}



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

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


Mime
View raw message