arturobernalg commented on code in PR #619:
URL:
https://github.com/apache/httpcomponents-client/pull/619#discussion_r1979959165
##########
httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartEntityBuilder.java:
##########
@@ -29,40 +29,53 @@
import java.io.File;
import java.io.InputStream;
-import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.concurrent.ThreadLocalRandom;
+import java.util.UUID;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.message.BasicNameValuePair;
import org.apache.hc.core5.util.Args;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Builder for multipart {@link HttpEntity}s.
+ * <p>
+ * This class constructs multipart entities with a boundary determined by
either a fixed
+ * value ("httpclient_boundary_7k9p2m4x8n5j3q6t1r0vwyzabcdefghi") or a random
UUID. If no
+ * boundary is explicitly set via {@link #setBoundary(String)}, it defaults to
the fixed
+ * value unless {@link #withRandomBoundary()} is called to request a random
UUID at build
+ * time. Users can provide a custom boundary with {@link
#setBoundary(String)}. A warning
+ * is logged when no explicit boundary is set via {@link
#setBoundary(String)}, encouraging
Review Comment:
> How can it happen that no explicit boundary is set? I mean you have to
deliberately call `#setBoundary(null)`?
Not setting a boundary—or explicitly setting it to null—signals that no
explicit value is provided, so the builder falls back to generating one (either
fixed or random based on configuration).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]