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:38:30 UTC

[07/11] httpcomponents-core git commit: Javadoc. Do not nest in else clauses unnecessarily. Don't hide ivars.Javadoc. Comment empty block.

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


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

Branch: refs/heads/master
Commit: 6b63fc188e248d68159aa1f918515c19bc3a5248
Parents: ba1bf60
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Aug 13 18:31:44 2018 -0600
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Aug 14 09:28:52 2018 +0200

----------------------------------------------------------------------
 .../org/apache/hc/core5/http/io/entity/FileEntity.java   | 10 ++++++++++
 .../hc/core5/http/io/entity/HttpEntityWrapper.java       |  4 +++-
 .../hc/core5/http/io/entity/SerializableEntity.java      | 11 ++++++++---
 .../org/apache/hc/core5/http/nio/FileContentDecoder.java |  5 +++--
 .../hc/core5/http/nio/entity/FileEntityProducer.java     |  1 -
 5 files changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6b63fc18/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java
index 48f8b3d..6470c96 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/FileEntity.java
@@ -45,6 +45,11 @@ public class FileEntity extends AbstractHttpEntity {
     private final File file;
 
     /**
+     * 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) {
@@ -56,6 +61,10 @@ public class FileEntity extends AbstractHttpEntity {
     }
 
     /**
+     * Creates a new instance.
+     *
+     * @param file The file to serve.
+     *
      * @since 4.2
      */
     public FileEntity(final File file) {
@@ -90,6 +99,7 @@ public class FileEntity extends AbstractHttpEntity {
 
     @Override
     public void close() throws IOException {
+        // do nothing
     }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6b63fc18/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
index f162859..154f95f 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/HttpEntityWrapper.java
@@ -54,11 +54,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/6b63fc18/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
index c1b5163..b7f0beb 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/entity/SerializableEntity.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/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 {
@@ -127,6 +131,7 @@ public class SerializableEntity extends AbstractHttpEntity {
 
     @Override
     public void close() throws IOException {
+        // do nothing.
     }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6b63fc18/httpcore5/src/main/java/org/apache/hc/core5/http/nio/FileContentDecoder.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/FileContentDecoder.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/FileContentDecoder.java
index 4321d9d..2fbde2d 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/FileContentDecoder.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/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/6b63fc18/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/FileEntityProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/FileEntityProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/FileEntityProducer.java
index bd7b18f..87782cf 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/FileEntityProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/entity/FileEntityProducer.java
@@ -49,7 +49,6 @@ public final class FileEntityProducer implements AsyncEntityProducer {
     private final long length;
     private final ContentType contentType;
     private final AtomicReference<Exception> exception;
-
     private final AtomicReference<RandomAccessFile> accessFileRef;
     private boolean eof;