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

commit be45aae7260c74febf6bdb8251b568325292880b
Author: Vladimir Sitnikov <[email protected]>
AuthorDate: Thu Jun 15 22:28:52 2023 +0300

    perf: cache UTF-8 representation of "<actual file content, not shown here>" 
in HttpClient4
---
 .../java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
 
b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
index 7d5bad22a6..cda36226a8 100644
--- 
a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
+++ 
b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
@@ -1503,6 +1503,8 @@ public class HTTPHC4Impl extends HTTPHCAbstractImpl {
 
     // Helper class so we can generate request data without dumping entire 
file contents
     private static class ViewableFileBody extends FileBody {
+        private static final byte[] CONTENTS_OMITTED =
+                "<actual file content, not shown 
here>".getBytes(StandardCharsets.UTF_8);
         private boolean hideFileData;
 
         public ViewableFileBody(File file, ContentType contentType) {
@@ -1513,7 +1515,7 @@ public class HTTPHC4Impl extends HTTPHCAbstractImpl {
         @Override
         public void writeTo(final OutputStream out) throws IOException {
             if (hideFileData) {
-                out.write("<actual file content, not shown 
here>".getBytes(StandardCharsets.UTF_8));
+                out.write(CONTENTS_OMITTED);
             } else {
                 super.writeTo(out);
             }

Reply via email to