Index: java/org/apache/commons/httpclient/HttpMethod.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java,v retrieving revision 1.32 diff -u -r1.32 HttpMethod.java --- java/org/apache/commons/httpclient/HttpMethod.java 19 Nov 2003 21:11:16 -0000 1.32 +++ java/org/apache/commons/httpclient/HttpMethod.java 9 Feb 2004 15:05:06 -0000 @@ -398,8 +398,10 @@ * * @return The response body, or null if the * body is not available. + * + * @throws IOException if an I/O (transport) problem occurs */ - byte[] getResponseBody(); + byte[] getResponseBody() throws IOException; /** * Returns the response body of the HTTP method, if any, as a {@link String}. @@ -413,8 +415,10 @@ * * @return The response body converted to a String, or null * if the body is not available. + * + * @throws IOException if an I/O (transport) problem occurs */ - String getResponseBodyAsString(); + String getResponseBodyAsString() throws IOException; /** * Returns the response body of the HTTP method, if any, as an InputStream. Index: java/org/apache/commons/httpclient/HttpMethodBase.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v retrieving revision 1.197 diff -u -r1.197 HttpMethodBase.java --- java/org/apache/commons/httpclient/HttpMethodBase.java 14 Jan 2004 20:48:43 -0000 1.197 +++ java/org/apache/commons/httpclient/HttpMethodBase.java 9 Feb 2004 15:05:08 -0000 @@ -672,26 +672,24 @@ * If response body is not available or cannot be read, returns null * * @return The response body. + * + * @throws IOException If an I/O (transport) problem occurs while obtaining the + * response body. */ - public byte[] getResponseBody() { + public byte[] getResponseBody() throws IOException { if (this.responseBody == null) { - try { - InputStream instream = getResponseBodyAsStream(); - if (instream != null) { - LOG.debug("Buffering response body"); - ByteArrayOutputStream outstream = new ByteArrayOutputStream(); - byte[] buffer = new byte[4096]; - int len; - while ((len = instream.read(buffer)) > 0) { - outstream.write(buffer, 0, len); - } - outstream.close(); - setResponseStream(null); - this.responseBody = outstream.toByteArray(); + InputStream instream = getResponseBodyAsStream(); + if (instream != null) { + LOG.debug("Buffering response body"); + ByteArrayOutputStream outstream = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int len; + while ((len = instream.read(buffer)) > 0) { + outstream.write(buffer, 0, len); } - } catch (IOException e) { - LOG.error("I/O failure reading response body", e); - this.responseBody = null; + outstream.close(); + setResponseStream(null); + this.responseBody = outstream.toByteArray(); } } return this.responseBody; @@ -725,8 +723,11 @@ * in Content-Type header. * * @return The response body. + * + * @throws IOException If an I/O (transport) problem occurs while obtaining the + * response body. */ - public String getResponseBodyAsString() { + public String getResponseBodyAsString() throws IOException { byte[] rawdata = null; if (responseAvailable()) { rawdata = getResponseBody(); Index: test/org/apache/commons/httpclient/TestHttpConnectionManager.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnectionManager.java,v retrieving revision 1.16 diff -u -r1.16 TestHttpConnectionManager.java --- test/org/apache/commons/httpclient/TestHttpConnectionManager.java 12 Jan 2004 23:03:12 -0000 1.16 +++ test/org/apache/commons/httpclient/TestHttpConnectionManager.java 9 Feb 2004 15:05:08 -0000 @@ -109,7 +109,7 @@ * Test that the ConnectMethod correctly releases connections when * CONNECT fails. */ - public void testConnectMethodFailureRelease() { + public void testConnectMethodFailureRelease() throws Exception { MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager(); mgr.getParams().setIntParameter( @@ -331,7 +331,7 @@ * Makes sure that a connection gets released after the content of the body * is read. */ - public void testResponseAutoRelease() { + public void testResponseAutoRelease() throws Exception { MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); connectionManager.getParams().setIntParameter( Index: test/org/apache/commons/httpclient/TestWebappCookie.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappCookie.java,v retrieving revision 1.13 diff -u -r1.13 TestWebappCookie.java --- test/org/apache/commons/httpclient/TestWebappCookie.java 20 Oct 2003 22:17:12 -0000 1.13 +++ test/org/apache/commons/httpclient/TestWebappCookie.java 9 Feb 2004 15:05:09 -0000 @@ -711,7 +711,7 @@ } - public void testCookiePolicies() { + public void testCookiePolicies() throws Exception { HttpClient client = createHttpClient(); Index: test/org/apache/commons/httpclient/TestWebappMethods.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappMethods.java,v retrieving revision 1.19 diff -u -r1.19 TestWebappMethods.java --- test/org/apache/commons/httpclient/TestWebappMethods.java 13 Jan 2004 18:47:27 -0000 1.19 +++ test/org/apache/commons/httpclient/TestWebappMethods.java 9 Feb 2004 15:05:09 -0000 @@ -359,7 +359,7 @@ } - public void testPostBodyChunked() { + public void testPostBodyChunked() throws Exception { HttpClient client = createHttpClient(); PostMethod method = new PostMethod("/" + getWebappContext() + "/body"); @@ -392,7 +392,7 @@ } - public void testPostMethodRecycle() { + public void testPostMethodRecycle() throws Exception { HttpClient client = createHttpClient(); PostMethod method = new PostMethod("/" + getWebappContext() + "/body");