You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2009/03/09 01:57:02 UTC
svn commit: r751563 - in /jakarta/jmeter/trunk:
src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
xdocs/changes.xml
Author: sebb
Date: Mon Mar 9 00:57:02 2009
New Revision: 751563
URL: http://svn.apache.org/viewvc?rev=751563&view=rev
Log:
Fix bug in HTTP file: handling - read bytes, not characters in the default encoding.
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
jakarta/jmeter/trunk/xdocs/changes.xml
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=751563&r1=751562&r2=751563&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java Mon Mar 9 00:57:02 2009
@@ -17,7 +17,7 @@
package org.apache.jmeter.protocol.http.sampler;
import java.io.ByteArrayOutputStream;
-import java.io.FileReader;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
@@ -1036,20 +1036,18 @@
res.setHTTPMethod(GET); // Dummy
res.setURL(uri.toURL());
res.setSampleLabel(uri.toString());
- FileReader reader = null;
+ FileInputStream fis = null;
res.sampleStart();
try {
byte[] responseData;
StringBuffer ctb=new StringBuffer("text/html"); // $NON-NLS-1$
- reader = new FileReader(getPath());
+ fis = new FileInputStream(getPath());
String contentEncoding = getContentEncoding();
- if (contentEncoding.length() == 0) {
- responseData = IOUtils.toByteArray(reader);
- } else {
+ if (contentEncoding.length() > 0) {
ctb.append("; charset="); // $NON-NLS-1$
ctb.append(contentEncoding);
- responseData = IOUtils.toByteArray(reader,contentEncoding);
}
+ responseData = IOUtils.toByteArray(fis);
res.sampleEnd();
res.setResponseData(responseData);
res.setResponseCodeOK();
@@ -1059,7 +1057,7 @@
res.setContentType(ct);
res.setEncodingAndType(ct);
} finally {
- IOUtils.closeQuietly(reader);
+ IOUtils.closeQuietly(fis);
}
//res.setResponseHeaders("");
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=751563&r1=751562&r2=751563&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Mon Mar 9 00:57:02 2009
@@ -188,6 +188,7 @@
<li>Bug 46491 - Incorrect value for the last variable in "CSV Data Set Config" (error in processing quoted strings)</li>
<li>The JMeter variable "sample_variables" is sent to all server instances to ensure the data is available to the client.</li>
<li>Bug 46821 - JDBC select request doesn't store the first column in the variables</li>
+<li>Fix bug in HTTP file: handling - read bytes, not characters in the default encoding.</li>
</ul>
<h3>Improvements</h3>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org