ASF Bugzilla – Attachment 34683 Details for
Bug 60652
PUT might leak file descriptors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Close files after reading them
01-fd-leak.diff (text/plain), 1.57 KB, created by
Felix Schumacher
on 2017-01-26 19:00:27 UTC
(
hide
)
Description:
Close files after reading them
Filename:
MIME Type:
Creator:
Felix Schumacher
Created:
2017-01-26 19:00:27 UTC
Size:
1.57 KB
patch
obsolete
>diff --git a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java >index 89591f4..8627ac0 100644 >--- a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java >+++ b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java >@@ -20,6 +20,7 @@ package org.apache.jmeter.protocol.http.sampler; > > import java.io.ByteArrayOutputStream; > import java.io.File; >+import java.io.InputStream; > import java.io.IOException; > import java.io.OutputStream; > import java.io.UnsupportedEncodingException; >@@ -1455,10 +1456,12 @@ public class HTTPHC4Impl extends HTTPHCAbstractImpl { > if(entityEntry.isRepeatable()) { > entityBody = new StringBuilder(1000); > // FIXME Charset >- entityBody.append(IOUtils.toString(new BoundedInputStream( >- entityEntry.getContent(), MAX_BODY_RETAIN_SIZE))); >- if (entityEntry.getContentLength() > MAX_BODY_RETAIN_SIZE) { >- entityBody.append("<actual file content shortened>"); >+ try (InputStream in = entityEntry.getContent(); >+ InputStream bounded = new BoundedInputStream(in, MAX_BODY_RETAIN_SIZE)) { >+ entityBody.append(IOUtils.toString(bounded)); >+ if (entityEntry.getContentLength() > MAX_BODY_RETAIN_SIZE) { >+ entityBody.append("<actual file content shortened>"); >+ } > } > } > else {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 60652
: 34683