Matt, what did you upgrade from? If you jumped from 2.3.2 to 3.3 and have 
custom mailets, you MAY have to recompile your custom mailets. I suggest using 
at least James 3.2.0 in your maven build file James versions, if not 3.3.0. 
That might mitigate some of the problems (of course, it will take some surgery 
as there are deprecated classes in use from 2.3.2 that have not beencarried 
into the 3.x chain). 

Sent from my iPhone

> On Aug 5, 2019, at 5:51 AM, Matt Pryor <pr...@international-presence.com> 
> wrote:
> 
> Here is the method going bang, with the problematic line highlighted in
> yellow - I guess mmis object must be null.
> 
>    public Response onLine(SMTPSession session, ByteBuffer lineByteBuffer,
> LineHandler<SMTPSession> next) {
> 
>        byte[] line = new byte[lineByteBuffer.remaining()];
>        lineByteBuffer.get(line, 0, line.length);
> 
>        MimeMessageInputStreamSource mmiss = (MimeMessageInputStreamSource)
> session.getAttachment(SMTPConstants.DATA_MIMEMESSAGE_STREAMSOURCE,
> State.Transaction);
> 
>        try {
>            OutputStream out = mmiss.getWritableOutputStream();
> 
>            // 46 is "."
>            // Stream terminated
>            if (line.length == 3 && line[0] == 46) {
>                out.flush();
>                out.close();
> 
>                @SuppressWarnings("unchecked")
>                List<MailAddress> recipientCollection = (List<MailAddress>)
> session.getAttachment(SMTPSession.RCPT_LIST, State.Transaction);
>                MaybeSender sender = (MaybeSender)
> session.getAttachment(SMTPSession.SENDER, State.Transaction);
> 
>                MailImpl mail = new MailImpl(MailImpl.getId(),
> Optional.ofNullable(sender).flatMap(MaybeSender::asOptional),
> recipientCollection);
> 
>                // store mail in the session so we can be sure it get
> disposed later
>                session.setAttachment(SMTPConstants.MAIL, mail,
> State.Transaction);
> 
>                MimeMessageCopyOnWriteProxy mimeMessageCopyOnWriteProxy =
> null;
>                try {
>                    mimeMessageCopyOnWriteProxy = new
> MimeMessageCopyOnWriteProxy(mmiss);
>                    mail.setMessage(mimeMessageCopyOnWriteProxy);
> 
>                    Response response = processExtensions(session, mail);
> 
>                    session.popLineHandler();
>                    return response;
> 
>                } catch (MessagingException e) {
>                    // TODO probably return a temporary problem
>                    LOGGER.info("Unexpected error handling DATA stream", e);
>                    return new SMTPResponse(SMTPRetCode.LOCAL_ERROR,
> "Unexpected error handling DATA stream.");
>                } finally {
>                    LifecycleUtil.dispose(mimeMessageCopyOnWriteProxy);
>                    LifecycleUtil.dispose(mmiss);
>                    LifecycleUtil.dispose(mail);
>                }
> 
>                // DotStuffing.
>            } else if (line[0] == 46 && line[1] == 46) {
>                out.write(line, 1, line.length - 1);
>                // Standard write
>            } else {
>                // TODO: maybe we should handle the Header/Body recognition
> here
>                // and if needed let a filter to cache the headers to apply
> some
>                // transformation before writing them to output.
>                out.write(line);
>            }
>        } catch (IOException e) {
>            LifecycleUtil.dispose(mmiss);
>            SMTPResponse response = new
> SMTPResponse(SMTPRetCode.LOCAL_ERROR,
> DSNStatus.getStatus(DSNStatus.TRANSIENT, DSNStatus.UNDEFINED_STATUS) + "
> Error processing message: " + e.getMessage());
>            LOGGER.error("Unknown error occurred while processing DATA.",
> e);
>            return response;
>        }
>        return null;
>    }
> 
> On Mon, 5 Aug 2019 at 10:40, Matt Pryor <pr...@international-presence.com>
> wrote:
> 
>> Hi there
>> 
>> I'm seeing the below NullPointerException when attempting to send email to
>> James. This stacktrace / error is repeated many times in the wrapper.log.
>> It appears that the message was received okay however.
>> 
>> I'm about to delve into the source to look for clues, but wondered if this
>> rings any bells.
>> 
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | ERROR 10:27:08,949 |
>> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | Unable to
>> process request
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | java.lang.NullPointerException
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.smtpserver.DataLineJamesMessageHookHandler.onLine(DataLineJamesMessageHookHandler.java:93)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.DataCmdHandler$DataLineFilterWrapper.onLine(DataCmdHandler.java:101)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.DataCmdHandler$DataLineFilterWrapper.onLine(DataCmdHandler.java:88)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.SeparatingDataLineFilter.onHeadersLine(SeparatingDataLineFilter.java:94)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.AbstractAddHeadersFilter.onHeadersLine(AbstractAddHeadersFilter.java:73)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.SeparatingDataLineFilter.onLine(SeparatingDataLineFilter.java:63)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.DataCmdHandler$DataLineFilterWrapper.onLine(DataCmdHandler.java:101)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.DataCmdHandler$DataLineFilterWrapper.onLine(DataCmdHandler.java:88)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.esmtp.MailSizeEsmtpExtension.onLine(MailSizeEsmtpExtension.java:187)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.DataCmdHandler$DataLineFilterWrapper.onLine(DataCmdHandler.java:101)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.smtp.core.DataCmdHandler$DataLineFilterWrapper.onLine(DataCmdHandler.java:88)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.apache.james.protocols.netty.LineHandlerUpstreamHandler.messageReceived(LineHandlerUpstreamHandler.java:50)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.channel.SimpleChannelUpstreamHandler.messageReceived(SimpleChannelUpstreamHandler.java:124)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(ChannelUpstreamEventRunnable.java:43)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:67)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.run(OrderedMemoryAwareThreadPoolExecutor.java:314)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>> INFO   | jvm 1    | 2019/08/05 10:27:08 | at java.lang.Thread.run(Unknown
>> Source)
>> 
>> 
>> Many thanks
>> Mattt
>> --
>> Matt Pryor
>> Software Developer
>> 
>> The International Presence Group of Companies
>> EMAIL: pr...@presencebpm.com
>> URL: www.International-presence.com
>> 
>> 
>> 
> 
> -- 
> Matt Pryor
> Software Developer
> 
> The International Presence Group of Companies
> EMAIL: pr...@presencebpm.com
> URL: www.International-presence.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org

Reply via email to