You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2017/01/26 19:33:21 UTC

svn commit: r1780442 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java xdocs/changes.xml

Author: fschumacher
Date: Thu Jan 26 19:33:21 2017
New Revision: 1780442

URL: http://svn.apache.org/viewvc?rev=1780442&view=rev
Log:
PUT might leak file descriptors.

Bugzilla Id: 60652

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1780442&r1=1780441&r2=1780442&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Thu Jan 26 19:33:21 2017
@@ -20,6 +20,7 @@ package org.apache.jmeter.protocol.http.
 
 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,8 +1456,10 @@ public class HTTPHC4Impl extends HTTPHCA
             if(entityEntry.isRepeatable()) {
                 entityBody = new StringBuilder(1000);
                 // FIXME Charset
-                entityBody.append(IOUtils.toString(new BoundedInputStream(
-                        entityEntry.getContent(), MAX_BODY_RETAIN_SIZE)));
+                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>");
                 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1780442&r1=1780441&r2=1780442&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Jan 26 19:33:21 2017
@@ -188,6 +188,7 @@ JMeter now requires Java 8. Ensure you u
     <li><bug>60531</bug>HTTP Cookie Manager : changing Implementation does not update Cookie Policy</li>
     <li><bug>60575</bug>HTTP GET Requests could have a content-type header without a body.</li>
     <li><bug>60643</bug>HTTP(S) Test Script Recorder doesn't correctly handle restart or start after stop. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
+    <li><bug>60652</bug>PUT might leak file descriptors.</li>
 </ul>
 
 <h3>Other Samplers</h3>