This is an automated email from the ASF dual-hosted git repository.
vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git
The following commit(s) were added to refs/heads/master by this push:
new 8fc7e8d92f style: refactor MultipartEntityBuilder2 to Java 17 swich
expression
8fc7e8d92f is described below
commit 8fc7e8d92f961a09f20191426d87cb75c6b60e14
Author: Vladimir Sitnikov <[email protected]>
AuthorDate: Mon Nov 3 22:29:52 2025 +0300
style: refactor MultipartEntityBuilder2 to Java 17 swich expression
---
.../apache/http/entity/mime/MultipartEntityBuilder2.java | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git
a/src/protocol/http/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder2.java
b/src/protocol/http/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder2.java
index d549d81a1b..f9e79ffb86 100644
---
a/src/protocol/http/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder2.java
+++
b/src/protocol/http/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder2.java
@@ -223,17 +223,11 @@ public class MultipartEntityBuilder2 {
final List<FormBodyPart> bodyPartsCopy = bodyParts != null ? new
ArrayList<>(bodyParts) :
Collections.emptyList();
final HttpMultipartMode modeCopy = mode != null ? mode :
HttpMultipartMode.STRICT;
- final AbstractMultipartForm form;
- switch (modeCopy) {
- case BROWSER_COMPATIBLE:
- form = new HttpBrowserCompatibleMultipart(charsetCopy,
boundaryCopy, bodyPartsCopy);
- break;
- case RFC6532:
- form = new HttpRFC6532Multipart(charsetCopy, boundaryCopy,
bodyPartsCopy);
- break;
- default:
- form = new HttpStrictMultipart(charsetCopy, boundaryCopy,
bodyPartsCopy);
- }
+ final AbstractMultipartForm form = switch (modeCopy) {
+ case BROWSER_COMPATIBLE -> new
HttpBrowserCompatibleMultipart(charsetCopy, boundaryCopy, bodyPartsCopy);
+ case RFC6532 -> new HttpRFC6532Multipart(charsetCopy,
boundaryCopy, bodyPartsCopy);
+ default -> new HttpStrictMultipart(charsetCopy, boundaryCopy,
bodyPartsCopy);
+ };
return new MultipartFormEntity(form, contentTypeCopy,
form.getTotalLength());
}