hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1100531 - in /httpcomponents/httpclient/trunk/httpclient/src: main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java test/java/org/apache/http/client/protocol/TestRedirects.java
Date Sat, 07 May 2011 13:42:15 GMT
Author: olegk
Date: Sat May  7 13:42:15 2011
New Revision: 1100531

URL: http://svn.apache.org/viewvc?rev=1100531&view=rev
Log:
Bogus redirects should result in an HttpException instead of IllegalStateException

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRedirects.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java?rev=1100531&r1=1100530&r2=1100531&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java
Sat May  7 13:42:15 2011
@@ -108,7 +108,12 @@ public class DefaultHttpRoutePlanner imp
         final HttpHost proxy =
             ConnRouteParams.getDefaultProxy(request.getParams());
 
-        final Scheme schm = schemeRegistry.getScheme(target.getSchemeName());
+        final Scheme schm;
+        try {
+            schm = schemeRegistry.getScheme(target.getSchemeName());
+        } catch (IllegalStateException ex) {
+            throw new HttpException(ex.getMessage());
+        }
         // as it is typically used for TLS/SSL, we assume that
         // a layered scheme implies a secure connection
         final boolean secure = schm.isLayered();

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRedirects.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRedirects.java?rev=1100531&r1=1100530&r2=1100531&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRedirects.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRedirects.java
Sat May  7 13:42:15 2011
@@ -586,7 +586,7 @@ public class TestRedirects extends Basic
         }
     }
 
-    @Test(expected=IllegalStateException.class)
+    @Test(expected=ClientProtocolException.class)
     public void testRejectBogusRedirectLocation() throws Exception {
         this.localServer.register("*", new BogusRedirectService("xxx://bogus"));
 



Mime
View raw message