hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1512339 - in /httpcomponents/httpclient/trunk/httpclient/src: main/java/org/apache/http/conn/ main/java/org/apache/http/impl/execchain/ test/java/org/apache/http/conn/ test/java/org/apache/http/cookie/ test/java/org/apache/http/impl/auth/ ...
Date Fri, 09 Aug 2013 15:21:58 GMT
Author: olegk
Date: Fri Aug  9 15:21:58 2013
New Revision: 1512339

URL: http://svn.apache.org/r1512339
Log:
Fixed some deprecation and varargs cast warnings; removed deprecated mock classes

Removed:
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/cookie/TestCookiePolicy.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/mockup/SecureSocketFactoryMockup.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/mockup/SocketFactoryMockup.java
Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ConnectTimeoutException.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpHostConnectException.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestExceptions.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestRFC2617Scheme.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ConnectTimeoutException.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ConnectTimeoutException.java?rev=1512339&r1=1512338&r2=1512339&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ConnectTimeoutException.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ConnectTimeoutException.java
Fri Aug  9 15:21:58 2013
@@ -76,8 +76,10 @@ public class ConnectTimeoutException ext
             final InetAddress... remoteAddresses) {
         super("Connect to " +
                 (host != null ? host.toHostString() : "remote host") +
-                (remoteAddresses != null ? " " + Arrays.asList(remoteAddresses) : "")
-                + ((cause != null && cause.getMessage() != null) ? " failed: " +
cause.getMessage() : " timed out"));
+                (remoteAddresses != null && remoteAddresses.length > 0 ?
+                        " " + Arrays.asList(remoteAddresses) : "") +
+                ((cause != null && cause.getMessage() != null) ?
+                        " failed: " + cause.getMessage() : " timed out"));
         this.host = host;
         initCause(cause);
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpHostConnectException.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpHostConnectException.java?rev=1512339&r1=1512338&r2=1512339&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpHostConnectException.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpHostConnectException.java
Fri Aug  9 15:21:58 2013
@@ -67,8 +67,10 @@ public class HttpHostConnectException ex
             final InetAddress... remoteAddresses) {
         super("Connect to " +
                 (host != null ? host.toHostString() : "remote host") +
-                (remoteAddresses != null ? " " + Arrays.asList(remoteAddresses) : "")
-                + ((cause != null && cause.getMessage() != null) ? " failed: " +
cause.getMessage() : " refused"));
+                (remoteAddresses != null && remoteAddresses .length > 0 ?
+                        " " + Arrays.asList(remoteAddresses) : "") +
+                ((cause != null && cause.getMessage() != null) ?
+                        " failed: " + cause.getMessage() : " refused"));
         this.host = host;
         initCause(cause);
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java?rev=1512339&r1=1512338&r2=1512339&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
Fri Aug  9 15:21:58 2013
@@ -78,12 +78,14 @@ public class ServiceUnavailableRetryExec
                 if (this.retryStrategy.retryRequest(response, c, context)) {
                     response.close();
                     final long nextInterval = this.retryStrategy.getRetryInterval();
-                    try {
-                        this.log.trace("Wait for " + nextInterval);
-                        Thread.sleep(nextInterval);
-                    } catch (final InterruptedException e) {
-                        Thread.currentThread().interrupt();
-                        throw new InterruptedIOException();
+                    if (nextInterval > 0) {
+                        try {
+                            this.log.trace("Wait for " + nextInterval);
+                            Thread.sleep(nextInterval);
+                        } catch (final InterruptedException e) {
+                            Thread.currentThread().interrupt();
+                            throw new InterruptedIOException();
+                        }
                     }
                 } else {
                     return response;
@@ -91,9 +93,6 @@ public class ServiceUnavailableRetryExec
             } catch (final RuntimeException ex) {
                 response.close();
                 throw ex;
-            } catch (final IOException ex) {
-                response.close();
-                throw ex;
             }
         }
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestExceptions.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestExceptions.java?rev=1512339&r1=1512338&r2=1512339&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestExceptions.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestExceptions.java
Fri Aug  9 15:21:58 2013
@@ -54,14 +54,14 @@ public class TestExceptions {
 
     @Test
     public void testConnectTimeoutExceptionFromNullCause() {
-        final ConnectTimeoutException ctx = new ConnectTimeoutException(null, null, null);
+        final ConnectTimeoutException ctx = new ConnectTimeoutException(null, null);
         Assert.assertEquals("Connect to remote host timed out", ctx.getMessage());
     }
 
     @Test
     public void testConnectTimeoutExceptionFromCause() {
         final IOException cause = new IOException("something awful");
-        final ConnectTimeoutException ctx = new ConnectTimeoutException(cause, null, null);
+        final ConnectTimeoutException ctx = new ConnectTimeoutException(cause, null);
         Assert.assertEquals("Connect to remote host failed: something awful", ctx.getMessage());
     }
 
@@ -69,7 +69,7 @@ public class TestExceptions {
     public void testConnectTimeoutExceptionFromCauseAndHost() {
         final HttpHost target = new HttpHost("localhost");
         final IOException cause = new IOException();
-        final ConnectTimeoutException ctx = new ConnectTimeoutException(cause, target, null);
+        final ConnectTimeoutException ctx = new ConnectTimeoutException(cause, target);
         Assert.assertEquals("Connect to localhost timed out", ctx.getMessage());
     }
 
@@ -84,14 +84,15 @@ public class TestExceptions {
 
     @Test
     public void testHttpHostConnectExceptionFromNullCause() {
-        final HttpHostConnectException ctx = new HttpHostConnectException(null, null, null);
+        final HttpHostConnectException ctx = new HttpHostConnectException(null, null,
+                (InetAddress [])null);
         Assert.assertEquals("Connect to remote host refused", ctx.getMessage());
     }
 
     @Test
     public void testHttpHostConnectExceptionFromCause() {
         final IOException cause = new IOException("something awful");
-        final HttpHostConnectException ctx = new HttpHostConnectException(cause, null, null);
+        final HttpHostConnectException ctx = new HttpHostConnectException(cause, null);
         Assert.assertEquals("Connect to remote host failed: something awful", ctx.getMessage());
     }
 
@@ -99,7 +100,7 @@ public class TestExceptions {
     public void testHttpHostConnectExceptionFromCauseAndHost() {
         final HttpHost target = new HttpHost("localhost");
         final IOException cause = new IOException();
-        final HttpHostConnectException ctx = new HttpHostConnectException(cause, target,
null);
+        final HttpHostConnectException ctx = new HttpHostConnectException(cause, target);
         Assert.assertEquals("Connect to localhost refused", ctx.getMessage());
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestRFC2617Scheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestRFC2617Scheme.java?rev=1512339&r1=1512338&r2=1512339&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestRFC2617Scheme.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestRFC2617Scheme.java
Fri Aug  9 15:21:58 2013
@@ -43,6 +43,7 @@ public class TestRFC2617Scheme {
 
     static class TestAuthScheme extends RFC2617Scheme {
 
+        @Deprecated
         public Header authenticate(
                 final Credentials credentials,
                 final HttpRequest request) throws AuthenticationException {



Mime
View raw message