Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java (working copy) @@ -30,7 +30,6 @@ import java.io.IOException; import java.net.ConnectException; -import java.net.URISyntaxException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; @@ -544,7 +543,7 @@ private static class CustomGet extends HttpGet { private final CountDownLatch releaseTriggerLatch; - public CustomGet(String uri, CountDownLatch releaseTriggerLatch) throws URISyntaxException { + public CustomGet(String uri, CountDownLatch releaseTriggerLatch) { super(uri); this.releaseTriggerLatch = releaseTriggerLatch; } Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java (working copy) @@ -426,9 +426,9 @@ try { client.execute(getServerHttp(), httpget); - fail("RedirectException exception should have been thrown"); - } catch (RedirectException e) { - // expected + fail("IOException exception should have been thrown"); + } catch (IOException e) { + assertTrue(e.getCause() instanceof RedirectException); } } @@ -442,9 +442,9 @@ try { client.execute(getServerHttp(), httpget); - fail("CircularRedirectException exception should have been thrown"); - } catch (CircularRedirectException e) { - // expected + fail("IOException exception should have been thrown"); + } catch (IOException e) { + assertTrue(e.getCause() instanceof CircularRedirectException); } } @@ -542,8 +542,9 @@ try { client.execute(getServerHttp(), httpget); - fail("ProtocolException exception should have been thrown"); - } catch (ProtocolException e) { + fail("IOException exception should have been thrown"); + } catch (IOException e) { + assertTrue(e.getCause() instanceof ProtocolException); // expected } } @@ -575,8 +576,9 @@ try { client.execute(getServerHttp(), httpget); - fail("ProtocolException should have been thrown"); - } catch (ProtocolException e) { + fail("IOException should have been thrown"); + } catch (IOException e) { + assertTrue(e.getCause() instanceof ProtocolException); // expected } } Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java (working copy) @@ -424,7 +424,7 @@ // non-javadoc, see interface HttpClient public final HttpResponse execute(HttpUriRequest request) - throws HttpException, IOException { + throws IOException { return execute(request, null); } @@ -441,7 +441,7 @@ */ public final HttpResponse execute(HttpUriRequest request, HttpContext context) - throws HttpException, IOException { + throws IOException { if (request == null) { throw new IllegalArgumentException @@ -466,7 +466,7 @@ // non-javadoc, see interface HttpClient public final HttpResponse execute(HttpHost target, HttpRequest request) - throws HttpException, IOException { + throws IOException { return execute(target, request, null); } @@ -475,7 +475,7 @@ // non-javadoc, see interface HttpClient public final HttpResponse execute(HttpHost target, HttpRequest request, HttpContext context) - throws HttpException, IOException { + throws IOException { if (request == null) { throw new IllegalArgumentException @@ -524,7 +524,14 @@ determineParams(request)); } - HttpResponse response = director.execute(target, request, execContext); + HttpResponse response; + try { + response = director.execute(target, request, execContext); + } catch(HttpException httpException) { + IOException iox = new IOException(); + iox.initCause(httpException); + throw iox; + } // If the response depends on the connection, the director // will have set up an auto-release input stream. Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/HttpClient.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/HttpClient.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/HttpClient.java (working copy) @@ -36,7 +36,6 @@ import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; -import org.apache.http.HttpException; import org.apache.http.params.HttpParams; import org.apache.http.protocol.HttpContext; import org.apache.http.client.methods.HttpUriRequest; @@ -87,14 +86,11 @@ * @param request the request to execute * * @return the response to the request - * - * @throws HttpException in case of a problem - * @throws IOException in case of an IO problem + * @throws IOException in case of a problem * or the connection was aborted - *
timeout exceptions? */ HttpResponse execute(HttpUriRequest request) - throws HttpException, IOException + throws IOException ; @@ -111,14 +107,11 @@ * Whether redirects or authentication challenges will be returned * or handled automatically depends on the implementation and * configuration of this client. - * - * @throws HttpException in case of a problem - * @throws IOException in case of an IO problem + * @throws IOException in case of a problem * or the connection was aborted - *
timeout exceptions? */ HttpResponse execute(HttpUriRequest request, HttpContext context) - throws HttpException, IOException + throws IOException ; @@ -137,14 +130,11 @@ * Whether redirects or authentication challenges will be returned * or handled automatically depends on the implementation and * configuration of this client. - * - * @throws HttpException in case of a problem - * @throws IOException in case of an IO problem + * @throws IOException in case of a problem * or the connection was aborted - *
timeout exceptions? */ HttpResponse execute(HttpHost target, HttpRequest request) - throws HttpException, IOException + throws IOException ; @@ -164,15 +154,12 @@ * Whether redirects or authentication challenges will be returned * or handled automatically depends on the implementation and * configuration of this client. - * - * @throws HttpException in case of a problem - * @throws IOException in case of an IO problem + * @throws IOException in case of a problem * or the connection was aborted - *
timeout exceptions? */ HttpResponse execute(HttpHost target, HttpRequest request, HttpContext context) - throws HttpException, IOException + throws IOException ; Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpGet.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpGet.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpGet.java (working copy) @@ -32,7 +32,6 @@ package org.apache.http.client.methods; import java.net.URI; -import java.net.URISyntaxException; /** * HTTP GET method. @@ -68,9 +67,12 @@ setURI(uri); } - public HttpGet(final String uri) throws URISyntaxException { + /** + * @throws IllegalArgumentException if the uri is invalid. + */ + public HttpGet(final String uri) { super(); - setURI(new URI(uri)); + setURI(URI.create(uri)); } @Override Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpHead.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpHead.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpHead.java (working copy) @@ -32,7 +32,6 @@ package org.apache.http.client.methods; import java.net.URI; -import java.net.URISyntaxException; /** * HTTP HEAD method. @@ -68,9 +67,12 @@ setURI(uri); } - public HttpHead(final String uri) throws URISyntaxException { + /** + * @throws IllegalArgumentException if the uri is invalid. + */ + public HttpHead(final String uri) { super(); - setURI(new URI(uri)); + setURI(URI.create(uri)); } @Override Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpDelete.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpDelete.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpDelete.java (working copy) @@ -32,7 +32,6 @@ package org.apache.http.client.methods; import java.net.URI; -import java.net.URISyntaxException; /** * HTTP DELETE method @@ -61,9 +60,12 @@ setURI(uri); } - public HttpDelete(final String uri) throws URISyntaxException { + /** + * @throws IllegalArgumentException if the uri is invalid. + */ + public HttpDelete(final String uri) { super(); - setURI(new URI(uri)); + setURI(URI.create(uri)); } @Override Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpPost.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpPost.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpPost.java (working copy) @@ -32,7 +32,6 @@ package org.apache.http.client.methods; import java.net.URI; -import java.net.URISyntaxException; /** * HTTP POST method. @@ -71,10 +70,13 @@ super(); setURI(uri); } - - public HttpPost(final String uri) throws URISyntaxException { + + /** + * @throws IllegalArgumentException if the uri is invalid. + */ + public HttpPost(final String uri) { super(); - setURI(new URI(uri)); + setURI(URI.create(uri)); } @Override Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpPut.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpPut.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpPut.java (working copy) @@ -32,7 +32,6 @@ package org.apache.http.client.methods; import java.net.URI; -import java.net.URISyntaxException; /** * HTTP PUT method. @@ -64,9 +63,12 @@ setURI(uri); } - public HttpPut(final String uri) throws URISyntaxException { + /** + * @throws IllegalArgumentException if the uri is invalid. + */ + public HttpPut(final String uri) { super(); - setURI(new URI(uri)); + setURI(URI.create(uri)); } @Override Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpOptions.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpOptions.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpOptions.java (working copy) @@ -32,7 +32,6 @@ package org.apache.http.client.methods; import java.net.URI; -import java.net.URISyntaxException; import java.util.HashSet; import java.util.Set; @@ -73,9 +72,12 @@ setURI(uri); } - public HttpOptions(final String uri) throws URISyntaxException { + /** + * @throws IllegalArgumentException if the uri is invalid. + */ + public HttpOptions(final String uri) { super(); - setURI(new URI(uri)); + setURI(URI.create(uri)); } @Override Index: C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpTrace.java =================================================================== --- C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpTrace.java (revision 660718) +++ C:/Documents and Settings/Sam/workspace/httpcomponents-client/module-client/src/main/java/org/apache/http/client/methods/HttpTrace.java (working copy) @@ -32,7 +32,6 @@ package org.apache.http.client.methods; import java.net.URI; -import java.net.URISyntaxException; /** * HTTP TRACE method. @@ -66,10 +65,13 @@ super(); setURI(uri); } - - public HttpTrace(final String uri) throws URISyntaxException { + + /** + * @throws IllegalArgumentException if the uri is invalid. + */ + public HttpTrace(final String uri) { super(); - setURI(new URI(uri)); + setURI(URI.create(uri)); } @Override