[jboss-remoting-commits] JBoss Remoting SVN: r4458 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Fri Aug 1 01:55:00 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-08-01 01:55:00 -0400 (Fri, 01 Aug 2008)
New Revision: 4458
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-990: (1) useHttpURLConnection() tries to add responseMessage and responseCode to CannotConnectException(); (2) readResponse() checks for EOF on inputStream and throws EOFException.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-08-01 05:53:42 UTC (rev 4457)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-08-01 05:55:00 UTC (rev 4458)
@@ -51,6 +51,7 @@
import org.jboss.util.threadpool.Task;
import org.jboss.util.threadpool.ThreadPool;
+import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -379,8 +380,21 @@
}
catch (Exception e)
{
- log.debug("Error invoking http client invoker.", e);
- throw new CannotConnectException("Can not connect http client invoker.", e);
+ String message = "Can not connect http client invoker.";
+ if (e.getMessage() != null)
+ message += " " + e.getMessage() + ".";
+
+ try
+ {
+ String responseMessage = conn.getResponseMessage();
+ int code = conn.getResponseCode();
+ message += " Response: " + responseMessage + "/" + code + ".";
+ }
+ catch (IOException e1)
+ {
+ log.debug("Unable to retrieve response message", e1);
+ }
+ throw new CannotConnectException(message, e);
}
// now check for error response and throw exception unless configured to not do so
@@ -501,9 +515,9 @@
}
private Object readResponse(Map metadata, Map headers, UnMarshaller unmarshaller, InputStream is)
- throws IOException, ClassNotFoundException
+ throws ClassNotFoundException, IOException
{
- Object result;
+ Object result = null;
String encoding = null;
Object ceObj = headers.get("Content-Encoding");
if (ceObj != null)
@@ -529,10 +543,25 @@
map.put(HTTPUnMarshaller.PRESERVE_LINES, o);
}
- if (unmarshaller instanceof VersionedUnMarshaller)
- result = ((VersionedUnMarshaller)unmarshaller).read(is, map, getVersion());
- else
- result = unmarshaller.read(is, map);
+ try
+ {
+ if (unmarshaller instanceof VersionedUnMarshaller)
+ result = ((VersionedUnMarshaller)unmarshaller).read(is, map, getVersion());
+ else
+ result = unmarshaller.read(is, map);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw e;
+ }
+ catch (IOException e)
+ {
+ if (-1 == is.read())
+ {
+ throw new EOFException();
+ }
+ throw e;
+ }
return result;
}
More information about the jboss-remoting-commits
mailing list