Author: ron.sigal(a)jboss.com
Date: 2008-10-25 02:19:22 -0400 (Sat, 25 Oct 2008)
New Revision: 4626
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-1046: Checks if HttpURLConnection.getInputStream() returns null.
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-10-25
03:22:08 UTC (rev 4625)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-10-25
06:19:22 UTC (rev 4626)
@@ -327,7 +327,7 @@
else
marshaller.write(invocation, stream);
responseCode = SecurityUtility.getResponseCode(conn);
- InputStream is = (responseCode < 400) ? conn.getInputStream() :
conn.getErrorStream();
+
Map headers = conn.getHeaderFields();
if (metadata == null)
{
@@ -353,7 +353,11 @@
metadata.put(HTTPMetadataConstants.RESPONSE_CODE, new
Integer(responseCode));
metadata.put(HTTPMetadataConstants.RESPONSE_HEADERS, headers);
- result = readResponse(metadata, headers, unmarshaller, is);
+ InputStream is = (responseCode < 400) ? conn.getInputStream() :
conn.getErrorStream();
+ if (is != null)
+ {
+ result = readResponse(metadata, headers, unmarshaller, is);
+ }
}
else
{
@@ -366,8 +370,11 @@
InputStream is = (SecurityUtility.getResponseCode(conn) < 400) ?
conn.getInputStream() : conn.getErrorStream();
Map headers = conn.getHeaderFields();
- result = readResponse(null, headers, unmarshaller, is);
-
+ if (is != null)
+ {
+ result = readResponse(null, headers, unmarshaller, is);
+ }
+
if (metadata == null)
{
metadata = new HashMap();