You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2021/10/30 09:49:25 UTC

[GitHub] [httpcomponents-client] michael-o commented on a change in pull request #319: HTTPCLIENT-2066 Provide ByteArrayBody constructors w/o filename parameter

michael-o commented on a change in pull request #319:
URL: https://github.com/apache/httpcomponents-client/pull/319#discussion_r739633160



##########
File path: httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/ByteArrayBody.java
##########
@@ -56,11 +56,24 @@
      */
     public ByteArrayBody(final byte[] data, final ContentType contentType, final String filename) {
         super(contentType);
-        Args.notNull(data, "byte[]");
-        this.data = data;
+        this.data  =Args.notNull(data, "byte[]");

Review comment:
       Missing space

##########
File path: httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/ByteArrayBody.java
##########
@@ -56,11 +56,24 @@
      */
     public ByteArrayBody(final byte[] data, final ContentType contentType, final String filename) {
         super(contentType);
-        Args.notNull(data, "byte[]");
-        this.data = data;
+        this.data  =Args.notNull(data, "byte[]");
         this.filename = filename;
     }
 
+    /**
+     * Public constructor that creates a new ByteArrayBody.
+     *
+     * @param contentType  the {@link ContentType}
+     * @param data the array of byte.
+     *
+     * @since 5.2
+     */
+    public ByteArrayBody(final byte[] data, final ContentType contentType) {
+        super(contentType);
+        this.data = Args.notNull(data, "byte[]");
+        this.filename = null;
+    }

Review comment:
       Why the code duplication instead of passing to the previous ctor?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org