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 al...@apache.org on 2007/10/16 20:16:33 UTC
svn commit: r585214 -
/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
Author: alf
Date: Tue Oct 16 11:16:33 2007
New Revision: 585214
URL: http://svn.apache.org/viewvc?rev=585214&view=rev
Log:
Remove workaround for bug in httpclient 3.0, it has been fixed in httpclient 3.1
>From the changelog of httpclient 3.1 :
* [HTTPCLIENT-612] - FileRequestEntity now always closes the input file.
Contributed by Sebastian Bazley <sebb at apache.org>
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java?rev=585214&r1=585213&r2=585214&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java Tue Oct 16 11:16:33 2007
@@ -18,7 +18,6 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -49,12 +48,12 @@
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.FileRequestEntity;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.HeadMethod;
import org.apache.commons.httpclient.methods.OptionsMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.httpclient.methods.TraceMethod;
import org.apache.commons.httpclient.methods.multipart.FilePart;
@@ -1004,46 +1003,6 @@
return null;
}
}
-
- // Implement locally, as current httpclient InputStreamRI implementation does not close file...
- private class FileRequestEntity implements RequestEntity {
-
- final File file;
- final String contentType;
-
- public FileRequestEntity(final File file, final String contentType) {
- super();
- if (file == null) {
- throw new IllegalArgumentException("File may not be null");
- }
- this.file = file;
- this.contentType = contentType;
- }
- public long getContentLength() {
- return this.file.length();
- }
-
- public String getContentType() {
- return this.contentType;
- }
-
- public boolean isRepeatable() {
- return true;
- }
-
- public void writeRequest(OutputStream out) throws IOException {
- InputStream in = new FileInputStream(this.file);
- try {
- int l;
- byte[] buffer = new byte[1024];
- while ((l = in.read(buffer)) != -1) {
- out.write(buffer, 0, l);
- }
- } finally {
- in.close();
- }
- }
- }
/**
* Class extending FilePart, so that we can send placeholder text
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org