You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/08/14 07:51:37 UTC

[02/12] httpcomponents-core git commit: Javadoc. Do not nest in else clauses unnecessarily. Don't hide ivars.

Javadoc. Do not nest in else clauses unnecessarily. Don't hide ivars.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/4592ae67
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/4592ae67
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/4592ae67

Branch: refs/heads/4.4.x
Commit: 4592ae67295000a674fc2461e3c5af2dee096cec
Parents: 5e7de73
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Aug 13 19:48:19 2018 -0600
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Aug 14 09:49:35 2018 +0200

----------------------------------------------------------------------
 .../org/apache/http/nio/FileContentDecoder.java |  5 +--
 .../http/impl/AbstractHttpClientConnection.java | 32 ++++++++++++--------
 .../java/org/apache/http/entity/FileEntity.java | 14 +++++++++
 .../apache/http/entity/HttpEntityWrapper.java   |  4 ++-
 .../apache/http/entity/SerializableEntity.java  | 16 +++++-----
 5 files changed, 48 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4592ae67/httpcore-nio/src/main/java/org/apache/http/nio/FileContentDecoder.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/FileContentDecoder.java b/httpcore-nio/src/main/java/org/apache/http/nio/FileContentDecoder.java
index 51014dd..6e543b0 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/FileContentDecoder.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/FileContentDecoder.java
@@ -39,11 +39,12 @@ public interface FileContentDecoder extends ContentDecoder {
 
     /**
      * Transfers a portion of entity content from the underlying network channel
-     * into the given file channel.<br>
-     *
+     * into the given file channel.
+     * <p>
      * <b>Warning</b>: Many implementations cannot write beyond the length of the file.
      *             If the position exceeds the channel's size, some implementations
      *             may throw an IOException.
+     * </p>
      *
      * @param  dst the target FileChannel to transfer data into.
      * @param  position

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4592ae67/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
index 6f2b816..d8e02f8 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
@@ -61,6 +61,7 @@ import org.apache.http.util.Args;
  * <p>
  * The following parameters can be used to customize the behavior of this
  * class:
+ * </p>
  * <ul>
  *  <li>{@link org.apache.http.params.CoreProtocolPNames#STRICT_TRANSFER_ENCODING}</li>
  *  <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_HEADER_COUNT}</li>
@@ -91,6 +92,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
      * and {@link #createEntitySerializer()} methods in order to initialize
      * HTTP entity serializer and deserializer implementations for this
      * connection.
+     * </p>
      */
     public AbstractHttpClientConnection() {
         super();
@@ -113,6 +115,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
      * This method can be overridden in a super class in order to create
      * instances of {@link EntityDeserializer} using a custom
      * {@link org.apache.http.entity.ContentLengthStrategy}.
+     * </p>
      *
      * @return HTTP entity deserializer
      */
@@ -128,6 +131,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
      * This method can be overridden in a super class in order to create
      * instances of {@link EntitySerializer} using a custom
      * {@link org.apache.http.entity.ContentLengthStrategy}.
+     * </p>
      *
      * @return HTTP entity serialzier.
      */
@@ -142,6 +146,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
      * <p>
      * This method can be overridden in a super class in order to provide
      * a different implementation of the {@link HttpResponseFactory} interface.
+     * </p>
      *
      * @return HTTP response factory.
      */
@@ -158,6 +163,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
      * to pass a different implementation of the
      * {@link org.apache.http.message.LineParser} to the the
      * {@link DefaultHttpResponseParser} constructor.
+     * </p>
      *
      * @param buffer the session input buffer.
      * @param responseFactory the HTTP response factory.
@@ -180,6 +186,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
      * to pass a different implementation of
      * {@link org.apache.http.message.LineFormatter} to the the default implementation
      * {@link HttpRequestWriter}.
+     * </p>
      *
      * @param buffer the session output buffer
      * @param params HTTP parameters
@@ -211,29 +218,30 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
      * and {@link #createResponseParser(SessionInputBuffer, HttpResponseFactory, HttpParams)}
      * methods to initialize HTTP request writer and response parser for this
      * connection.
+     * </p>
      *
-     * @param inBuffer the session input buffer.
-     * @param outbuffer the session output buffer.
+     * @param sessionInputBuffer the session input buffer.
+     * @param sessionOutputBuffer the session output buffer.
      * @param params HTTP parameters.
      */
     protected void init(
-            final SessionInputBuffer inBuffer,
-            final SessionOutputBuffer outbuffer,
+            final SessionInputBuffer sessionInputBuffer,
+            final SessionOutputBuffer sessionOutputBuffer,
             final HttpParams params) {
-        this.inBuffer = Args.notNull(inBuffer, "Input session buffer");
-        this.outbuffer = Args.notNull(outbuffer, "Output session buffer");
-        if (inBuffer instanceof EofSensor) {
-            this.eofSensor = (EofSensor) inBuffer;
+        this.inBuffer = Args.notNull(sessionInputBuffer, "Input session buffer");
+        this.outbuffer = Args.notNull(sessionOutputBuffer, "Output session buffer");
+        if (sessionInputBuffer instanceof EofSensor) {
+            this.eofSensor = (EofSensor) sessionInputBuffer;
         }
         this.responseParser = createResponseParser(
-                inBuffer,
+                sessionInputBuffer,
                 createHttpResponseFactory(),
                 params);
         this.requestWriter = createRequestWriter(
-                outbuffer, params);
+                sessionOutputBuffer, params);
         this.metrics = createConnectionMetrics(
-                inBuffer.getMetrics(),
-                outbuffer.getMetrics());
+                sessionInputBuffer.getMetrics(),
+                sessionOutputBuffer.getMetrics());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4592ae67/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/FileEntity.java b/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
index 9ad2210..05448d6 100644
--- a/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
@@ -45,6 +45,11 @@ public class FileEntity extends AbstractHttpEntity implements Cloneable {
     protected final File file;
 
     /**
+     * Creates a new instance.
+     *
+     * @param file The file to serve.
+     * @param contentType  The content type for the given {@code file}.
+     *
      * @deprecated (4.1.3) {@link #FileEntity(File, ContentType)}
      */
     @Deprecated
@@ -55,6 +60,11 @@ public class FileEntity extends AbstractHttpEntity implements Cloneable {
     }
 
     /**
+     * Creates a new instance.
+     *
+     * @param file The file to serve.
+     * @param contentType  The content type for the given {@code file}.
+     *
      * @since 4.2
      */
     public FileEntity(final File file, final ContentType contentType) {
@@ -66,6 +76,10 @@ public class FileEntity extends AbstractHttpEntity implements Cloneable {
     }
 
     /**
+     * Creates a new instance.
+     *
+     * @param file The file to serve.
+     *
      * @since 4.2
      */
     public FileEntity(final File file) {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4592ae67/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java b/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
index 6081cbb..da91352 100644
--- a/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
+++ b/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
@@ -51,11 +51,13 @@ public class HttpEntityWrapper implements HttpEntity {
 
     /**
      * Creates a new entity wrapper.
+     *
+     * @param wrappedEntity the entity to wrap.
      */
     public HttpEntityWrapper(final HttpEntity wrappedEntity) {
         super();
         this.wrappedEntity = Args.notNull(wrappedEntity, "Wrapped entity");
-    } // constructor
+    }
 
     @Override
     public boolean isRepeatable() {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4592ae67/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java b/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java
index 573df42..675c008 100644
--- a/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/SerializableEntity.java
@@ -70,12 +70,16 @@ public class SerializableEntity extends AbstractHttpEntity {
     }
 
     /**
+     * Creates new instance of this class.
+     *
+     * @param serializable The object to serialize.
+     *
      * @since 4.3
      */
-    public SerializableEntity(final Serializable ser) {
+    public SerializableEntity(final Serializable serializable) {
         super();
-        Args.notNull(ser, "Source object");
-        this.objRef = ser;
+        Args.notNull(serializable, "Source object");
+        this.objRef = serializable;
     }
 
     private void createBytes(final Serializable ser) throws IOException {
@@ -96,11 +100,7 @@ public class SerializableEntity extends AbstractHttpEntity {
 
     @Override
     public long getContentLength() {
-        if (this.objSer ==  null) {
-            return -1;
-        } else {
-            return this.objSer.length;
-        }
+        return this.objSer ==  null ? -1 : this.objSer.length;
     }
 
     @Override