hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yongxing Wang <yongxing_w...@yahoo.com>
Subject NullPointerException in AsyncNHttpClientHandler
Date Fri, 13 Nov 2009 19:43:28 GMT
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


Mime
View raw message