hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1487830 [2/2] - in /httpcomponents/httpcore/trunk: ./ httpcore-ab/ httpcore-ab/src/main/java/org/apache/http/benchmark/ httpcore-nio/ httpcore-nio/src/main/java/org/apache/http/impl/nio/ httpcore-nio/src/main/java/org/apache/http/impl/nio/...
Date Thu, 30 May 2013 12:40:36 GMT
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
Thu May 30 12:40:34 2013
@@ -29,6 +29,7 @@ package org.apache.http.message;
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 
@@ -125,9 +126,7 @@ public class HeaderGroup implements Clon
         if (headers == null) {
             return;
         }
-        for (final Header header : headers) {
-            this.headers.add(header);
-        }
+        Collections.addAll(this.headers, headers);
     }
 
     /**
@@ -173,8 +172,7 @@ public class HeaderGroup implements Clon
     public Header[] getHeaders(final String name) {
         final List<Header> headersFound = new ArrayList<Header>();
 
-        for (int i = 0; i < headers.size(); i++) {
-            final Header header = headers.get(i);
+        for (final Header header : headers) {
             if (header.getName().equalsIgnoreCase(name)) {
                 headersFound.add(header);
             }
@@ -192,8 +190,7 @@ public class HeaderGroup implements Clon
      * @return the first header or <code>null</code>
      */
     public Header getFirstHeader(final String name) {
-        for (int i = 0; i < headers.size(); i++) {
-            final Header header = headers.get(i);
+        for (final Header header : headers) {
             if (header.getName().equalsIgnoreCase(name)) {
                 return header;
             }
@@ -240,8 +237,7 @@ public class HeaderGroup implements Clon
      * contained, <code>false</code> otherwise
      */
     public boolean containsHeader(final String name) {
-        for (int i = 0; i < headers.size(); i++) {
-            final Header header = headers.get(i);
+        for (final Header header : headers) {
             if (header.getName().equalsIgnoreCase(name)) {
                 return true;
             }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/AbstractHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/AbstractHttpParams.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/AbstractHttpParams.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/AbstractHttpParams.java
Thu May 30 12:40:34 2013
@@ -54,11 +54,11 @@ public abstract class AbstractHttpParams
         if (param == null) {
             return defaultValue;
         }
-        return ((Long)param).longValue();
+        return (Long) param;
     }
 
     public HttpParams setLongParameter(final String name, final long value) {
-        setParameter(name, new Long(value));
+        setParameter(name, value);
         return this;
     }
 
@@ -67,11 +67,11 @@ public abstract class AbstractHttpParams
         if (param == null) {
             return defaultValue;
         }
-        return ((Integer)param).intValue();
+        return (Integer) param;
     }
 
     public HttpParams setIntParameter(final String name, final int value) {
-        setParameter(name, new Integer(value));
+        setParameter(name, value);
         return this;
     }
 
@@ -80,11 +80,11 @@ public abstract class AbstractHttpParams
         if (param == null) {
             return defaultValue;
         }
-        return ((Double)param).doubleValue();
+        return (Double) param;
     }
 
     public HttpParams setDoubleParameter(final String name, final double value) {
-        setParameter(name, new Double(value));
+        setParameter(name, value);
         return this;
     }
 
@@ -93,7 +93,7 @@ public abstract class AbstractHttpParams
         if (param == null) {
             return defaultValue;
         }
-        return ((Boolean)param).booleanValue();
+        return (Boolean) param;
     }
 
     public HttpParams setBooleanParameter(final String name, final boolean value) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
Thu May 30 12:40:34 2013
@@ -319,7 +319,7 @@ public abstract class AbstractConnPool<T
     private int getMax(final T route) {
         final Integer v = this.maxPerRoute.get(route);
         if (v != null) {
-            return v.intValue();
+            return v;
         } else {
             return this.defaultMaxPerRoute;
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
Thu May 30 12:40:34 2013
@@ -143,7 +143,7 @@ public abstract class PoolEntry<T, C> {
     public synchronized void updateExpiry(final long time, final TimeUnit tunit) {
         Args.notNull(tunit, "Time unit");
         this.updated = System.currentTimeMillis();
-        long newExpiry;
+        final long newExpiry;
         if (time > 0) {
             newExpiry = this.updated + tunit.toMillis(time);
         } else {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntryFuture.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntryFuture.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntryFuture.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntryFuture.java
Thu May 30 12:40:34 2013
@@ -37,6 +37,7 @@ import java.util.concurrent.locks.Lock;
 
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.concurrent.FutureCallback;
+import org.apache.http.util.Args;
 
 @ThreadSafe
 abstract class PoolEntryFuture<T> implements Future<T> {
@@ -92,6 +93,7 @@ abstract class PoolEntryFuture<T> implem
     public T get(
             final long timeout,
             final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
{
+        Args.notNull(unit, "Time unit");
         this.lock.lock();
         try {
             if (this.completed) {
@@ -124,7 +126,7 @@ abstract class PoolEntryFuture<T> implem
             if (this.cancelled) {
                 throw new InterruptedException("Operation interrupted");
             }
-            boolean success = false;
+            final boolean success;
             if (deadline != null) {
                 success = this.condition.awaitUntil(deadline);
             } else {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpProcessor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpProcessor.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpProcessor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpProcessor.java
Thu May 30 12:40:34 2013
@@ -176,13 +176,12 @@ public final class BasicHttpProcessor im
         Args.notNull(list, "Inteceptor list");
         this.requestInterceptors.clear();
         this.responseInterceptors.clear();
-        for (int i = 0; i < list.size(); i++) {
-            final Object obj = list.get(i);
+        for (final Object obj : list) {
             if (obj instanceof HttpRequestInterceptor) {
-                addInterceptor((HttpRequestInterceptor)obj);
+                addInterceptor((HttpRequestInterceptor) obj);
             }
             if (obj instanceof HttpResponseInterceptor) {
-                addInterceptor((HttpResponseInterceptor)obj);
+                addInterceptor((HttpResponseInterceptor) obj);
             }
         }
     }
@@ -199,9 +198,7 @@ public final class BasicHttpProcessor im
             final HttpRequest request,
             final HttpContext context)
             throws IOException, HttpException {
-        for (int i = 0; i < this.requestInterceptors.size(); i++) {
-            final HttpRequestInterceptor interceptor =
-                this.requestInterceptors.get(i);
+        for (final HttpRequestInterceptor interceptor : this.requestInterceptors) {
             interceptor.process(request, context);
         }
     }
@@ -210,9 +207,7 @@ public final class BasicHttpProcessor im
             final HttpResponse response,
             final HttpContext context)
             throws IOException, HttpException {
-        for (int i = 0; i < this.responseInterceptors.size(); i++) {
-            final HttpResponseInterceptor interceptor =
-                this.responseInterceptors.get(i);
+        for (final HttpResponseInterceptor interceptor : this.responseInterceptors) {
             interceptor.process(response, context);
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpCoreContext.java
Thu May 30 12:40:34 2013
@@ -134,7 +134,7 @@ public class HttpCoreContext implements 
 
     public boolean isRequestSent() {
         final Boolean b = getAttribute(HTTP_REQ_SENT, Boolean.class);
-        return b != null ? b.booleanValue() : false;
+        return b != null && b;
     }
 
     public HttpResponse getResponse() {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestExecutor.java
Thu May 30 12:40:34 2013
@@ -136,7 +136,7 @@ public class HttpRequestExecutor {
         }
     }
 
-    private final static void closeConnection(final HttpClientConnection conn) {
+    private static void closeConnection(final HttpClientConnection conn) {
         try {
             conn.close();
         } catch (final IOException ignore) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
Thu May 30 12:40:34 2013
@@ -65,7 +65,7 @@ public final class EntityUtils {
     public static void consumeQuietly(final HttpEntity entity) {
         try {
           consume(entity);
-        } catch (final IOException ioex) {
+        } catch (final IOException ignore) {
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ExceptionUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ExceptionUtils.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ExceptionUtils.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ExceptionUtils.java
Thu May 30 12:40:34 2013
@@ -69,7 +69,7 @@ public final class ExceptionUtils {
     public static void initCause(final Throwable throwable, final Throwable cause) {
         if (INIT_CAUSE_METHOD != null) {
             try {
-                INIT_CAUSE_METHOD.invoke(throwable, new Object[] { cause });
+                INIT_CAUSE_METHOD.invoke(throwable, cause);
             } catch (final Exception e) {
                 // Well, with no logging, the only option is to munch the exception
             }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/LangUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/LangUtils.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/LangUtils.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/LangUtils.java
Thu May 30 12:40:34 2013
@@ -83,11 +83,7 @@ public final class LangUtils {
      */
     public static boolean equals(final Object[] a1, final Object[] a2) {
         if (a1 == null) {
-            if (a2 == null) {
-                return true;
-            } else {
-                return false;
-            }
+            return a2 == null;
         } else {
             if (a2 != null && a1.length == a2.length) {
                 for (int i = 0; i < a1.length; i++) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
Thu May 30 12:40:34 2013
@@ -193,7 +193,7 @@ public class VersionInfo {
      * @return  the version information for all packages found,
      *          never <code>null</code>
      */
-    public final static VersionInfo[] loadVersionInfo(final String[] pckgs,
+    public static VersionInfo[] loadVersionInfo(final String[] pckgs,
                                                       final ClassLoader clsldr) {
         Args.notNull(pckgs, "Package identifier array");
         final List<VersionInfo> vil = new ArrayList<VersionInfo>(pckgs.length);
@@ -220,7 +220,7 @@ public class VersionInfo {
      * @return  the version information for the argument package, or
      *          <code>null</code> if not available
      */
-    public final static VersionInfo loadVersionInfo(final String pckg,
+    public static VersionInfo loadVersionInfo(final String pckg,
                                                     ClassLoader clsldr) {
         Args.notNull(pckg, "Package identifier");
         if (clsldr == null) {
@@ -265,7 +265,7 @@ public class VersionInfo {
      *
      * @return  the version information
      */
-    protected final static VersionInfo fromMap(final String pckg, final Map<?, ?> info,
+    protected static VersionInfo fromMap(final String pckg, final Map<?, ?> info,
                                                final ClassLoader clsldr) {
         Args.notNull(pckg, "Package identifier");
         String module = null;

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java
Thu May 30 12:40:34 2013
@@ -53,7 +53,6 @@ public class TestBasicConnPool {
     private ServerSocket server;
     private int serverPort;
 
-    private SSLServerSocket sslServer;
     private int sslServerPort;
 
     @Before
@@ -63,7 +62,7 @@ public class TestBasicConnPool {
         serverPort = server.getLocalPort();
 
         // setup an "https" server
-        sslServer = (SSLServerSocket) SSLServerSocketFactory.getDefault().createServerSocket(0);
+        final SSLServerSocket sslServer = (SSLServerSocket) SSLServerSocketFactory.getDefault().createServerSocket(0);
         sslServerPort = sslServer.getLocalPort();
 
         final SocketConfig sconfig = SocketConfig.custom().setSoTimeout(100).build();

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/HttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/HttpClient.java?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/HttpClient.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/HttpClient.java
Thu May 30 12:40:34 2013
@@ -92,8 +92,7 @@ public class HttpClient {
     }
 
     public DefaultBHttpClientConnection createConnection() {
-        final LoggingBHttpClientConnection conn = new LoggingBHttpClientConnection(8 * 1024);
-        return conn;
+        return new LoggingBHttpClientConnection(8 * 1024);
     }
 
     public void connect(final HttpHost host, final DefaultBHttpClientConnection conn) throws
IOException {

Modified: httpcomponents/httpcore/trunk/pom.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/pom.xml?rev=1487830&r1=1487829&r2=1487830&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/pom.xml (original)
+++ httpcomponents/httpcore/trunk/pom.xml Thu May 30 12:40:34 2013
@@ -72,6 +72,7 @@
   </modules>
 
   <properties>
+    <maven.compile.deprecation>false</maven.compile.deprecation>
     <junit.version>4.9</junit.version>
     <mockito.version>1.8.5</mockito.version>
     <commons-logging.version>1.1.1</commons-logging.version>



Mime
View raw message