Recently, I've been getting errors that don't seem to want to be
handled, regardless of there being the correct catch block in my code...
---LOG---
2006/01/11 11:16:55:860 EST [DEBUG] EntityEnclosingMethod - Request body
sent
2006/01/11 11:17:00:860 EST [DEBUG] HttpMethodDirector - Closing the
connection.
2006/01/11 11:17:00:860 EST [DEBUG] HttpMethodDirector - Method retry
handler returned false. Automatic recovery will not be attempted
2006/01/11 11:17:00:860 EST [DEBUG] HttpConnection - Releasing
connection back to connection manager.
>>> Why are we getting null? true
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at
org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
at
org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
at
org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1113)
at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:395)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at net.telestatic.mousemove.MouseComm.connection(MouseComm.java:210)
at net.telestatic.mousemove.MouseWatch.run(MouseWatch.java:98)
>>> Releasing connection...
2006/01/11 11:17:00:860 EST [DEBUG] HttpConnection - Releasing
connection back to connection manager.
2006/01/11 11:17:00:860 EST [WARN] SimpleHttpConnectionManager -
SimpleHttpConnectionManager being used incorrectly. Be sure that
HttpMethod.releaseConnection() is always called and that only one thread
and/or method is using this connection manager at a time.
Exception in thread "Thread-8" java.lang.NullPointerException
at net.telestatic.mousemove.MouseComm.connection(MouseComm.java:226)
at net.telestatic.mousemove.MouseWatch.run(MouseWatch.java:98)
---LOG---
From the log, I see and understand that the timeout is occuring before
the entirety of the content is read in, but I thought that the following
would catch it:
---CODE---
try{
client.executeMethod(method);
processReturn(new InputStreamReader(method.getResponseBodyAsStream(),
method.getResponseCharSet()));
} catch (HttpException he) {
if (MouseWatch.watchMouse == true) {
renderPage(HTMLUpdateFalsePage.toString(),
true);
MouseWatch.currentInterval = 0;
} else {
MouseClient.showAlert("MouseMove couldn't open a connection to the
server");
MouseClient.clientFrame.toFront();
}
} catch (IOException ioe) {
ioe.printStackTrace();
if (MouseWatch.watchMouse == true) {
renderPage(HTMLUpdateFalsePage.toString(),
true);
MouseWatch.currentInterval = 0;
} else {
MouseClient.showAlert("MouseMove could not talk to
the server");
MouseClient.clientFrame.toFront();
}
} finally {
System.err.println(">>> Releasing connection...");
method.releaseConnection();
MouseClient.loginButton.setEnabled(true);
}
---CODE---
So I'm getting a NullPointerException that should be caught by
IOException, at which point the method renderPage renders a static page
I already have standing by to inform the end-user that the connection
screwed up (providing they were already logged in, which is what the
watchMouse == true part is about).
Setting the timeout to 30 seconds remedies the problem in the short
term, but that's just "ignoring" the problem that the connection manager
doesn't seem to hand off the exception properly?
I'm using httpclient 3.0-rc4.
Hope someone can either tell me that it's not a httpclient problem, in
which case I'll shut up and attempt to resolve the problem, or if it's
just some configuration directive I've missed.
Thanks!
~Chris
--
~Chris Ashurst
~~Tower Hill Insurance
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]