camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-7894) Encoder exception after sending a message with null body
Date Thu, 09 Oct 2014 02:38:34 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-7894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Willem Jiang resolved CAMEL-7894.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.15.0
                   2.14.1

Applied the patch into camel master, camel-2.14.x branches.

> Encoder exception after sending a message with null body
> --------------------------------------------------------
>
>                 Key: CAMEL-7894
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7894
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-netty4-http
>    Affects Versions: 2.14.0
>            Reporter: Elyran Kogan
>            Assignee: Willem Jiang
>             Fix For: 2.14.1, 2.15.0
>
>
> when sending a request with a null body ( it was GET request in my case)
> I got the following exception.
> after investigating the issue I found that because the body is null - the request is
created with type DefaultHttpRequest and not DefaultFullHttpRequest which is created when
there is a body
> this causes the HttpObjectEncoder to stay in a wrong state after the request is sent,
because of this code:
>  if (msg instanceof LastHttpContent) {
>       state = ST_INIT;
> }
> so the next request will fail with the exception.
> the workaround is simple - use an empty string as body
> also - this did not happen in camel-netty-http
> the exception:
> Caused by: io.netty.handler.codec.EncoderException: java.lang.IllegalStateException:
unexpected message type: DefaultFullHttpRequest at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107)
at io.netty.channel.CombinedChannelDuplexHandler.write(CombinedChannelDuplexHandler.java:192)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
at io.netty.channel.AbstractChannelHandlerContext.access$2000(AbstractChannelHandlerContext.java:32)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:939)
at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:991)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:924)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: unexpected
message type: DefaultFullHttpRequest at io.netty.handler.codec.http.HttpObjectEncoder.encode(HttpObjectEncoder.java:63)
at io.netty.handler.codec.http.HttpClientCodec$Encoder.encode(HttpClientCodec.java:106) at
io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ...
10 more



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message