You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Yongxing Wang <yo...@yahoo.com> on 2009/11/13 20:43:28 UTC
NullPointerException in AsyncNHttpClientHandler
Oleg,
I am using http nio/core (version 4.0.1) and I got some NullPointerException when the connection times out.
[10002 /127.0.0.1:3556] 2009/11/13 11:29:58.665-0800 DEBUG;[nio.impl.HttpIoReactor:218] Unhandled RuntimeException:
java.lang.NullPointerException
at org.apache.http.nio.protocol.AsyncNHttpClientHandler.timeout(AsyncNHttpClientHandler.java:344)
at org.apache.http.impl.nio.DefaultClientIOEventDispatch.timeout(DefaultClientIOEventDispatch.java:158)
at org.apache.http.impl.nio.reactor.BaseIOReactor.timeoutCheck(BaseIOReactor.java:255)
at org.apache.http.impl.nio.reactor.BaseIOReactor.validate(BaseIOReactor.java:203)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:260)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:96)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:556)
Looking at the code,
ClientConnState connState = (ClientConnState) context.getAttribute(CONN_STATE);
try {
if (connState.getOutputState() == ClientConnState.EXPECT_CONTINUE) {
......
}catch(IOException e){
}
handleTimeout();
It could happen if the attribute get removed somehow before execution comes here.... It might be safer to check it being NULL or not....
Thanks,
Yong
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: NullPointerException in AsyncNHttpClientHandler
Posted by Oleg Kalnichevski <ol...@apache.org>.
Yongxing Wang wrote:
> Oleg,
>
> I am using http nio/core (version 4.0.1) and I got some NullPointerException when the connection times out.
>
> [10002 /127.0.0.1:3556] 2009/11/13 11:29:58.665-0800 DEBUG;[nio.impl.HttpIoReactor:218] Unhandled RuntimeException:
> java.lang.NullPointerException
> at org.apache.http.nio.protocol.AsyncNHttpClientHandler.timeout(AsyncNHttpClientHandler.java:344)
> at org.apache.http.impl.nio.DefaultClientIOEventDispatch.timeout(DefaultClientIOEventDispatch.java:158)
> at org.apache.http.impl.nio.reactor.BaseIOReactor.timeoutCheck(BaseIOReactor.java:255)
> at org.apache.http.impl.nio.reactor.BaseIOReactor.validate(BaseIOReactor.java:203)
> at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:260)
> at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:96)
> at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:556)
>
> Looking at the code,
>
> ClientConnState connState = (ClientConnState) context.getAttribute(CONN_STATE);
>
> try {
>
> if (connState.getOutputState() == ClientConnState.EXPECT_CONTINUE) {
> ......
>
> }catch(IOException e){
> }
> handleTimeout();
>
>
> It could happen if the attribute get removed somehow before execution comes here.... It might be safer to check it being NULL or not....
>
> Thanks,
> Yong
>
>
Hi Yong
I will add a check for the attribute being non null, I just cannot see
how it can happen.
Anyway, many thanks for reporting the problem.
Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org