On Wed, 2006-01-11 at 11:29 -0500, Chris Ashurst wrote:
> 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...
...
> >>> 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.
Chris,
Upgrade to 3.0 final to make this warning go away.
> 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:
>
This is clearly a bug in your code. See MouseComm.java, line 226.
> ---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,
No. NullPointerException is a runtime exception. It cannot be caught by
catching IOExceptions.
> 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,
It does not look like a problem with HttpClient to me
Oleg
> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]