jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1227014 - in /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http: proxy/Proxy.java sampler/HTTPHC4Impl.java sampler/PostWriter.java util/LoopbackHTTPSocket.java
Date Wed, 04 Jan 2012 01:29:12 GMT
Author: sebb
Date: Wed Jan  4 01:29:11 2012
New Revision: 1227014

URL: http://svn.apache.org/viewvc?rev=1227014&view=rev
Log:
Fix up some missing encodings (Findbugs)

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/LoopbackHTTPSocket.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1227014&r1=1227013&r2=1227014&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Wed Jan
 4 01:29:11 2012
@@ -191,7 +191,7 @@ public class Proxy extends Thread {
             if ((request.getMethod().startsWith(HTTPConstants.CONNECT)) && (outStreamClient
!= null)) {
                 log.debug("Method CONNECT => SSL");
                 // write a OK reponse to browser, to engage SSL exchange
-                outStreamClient.write(("HTTP/1.0 200 OK\r\n\r\n").getBytes()); // $NON-NLS-1$
// TODO charset?
+                outStreamClient.write(("HTTP/1.0 200 OK\r\n\r\n").getBytes(SampleResult.DEFAULT_HTTP_ENCODING));
// $NON-NLS-1$
                 outStreamClient.flush();
                // With ssl request, url is host:port (without https:// or path)
                 String[] param = request.getUrl().split(":");  // $NON-NLS-1$
@@ -431,7 +431,7 @@ public class Proxy extends Thread {
     private void writeToClient(SampleResult res, OutputStream out, boolean forcedHTTPS) throws
IOException {
         try {
             String responseHeaders = massageResponseHeaders(res, forcedHTTPS);
-            out.write(responseHeaders.getBytes()); // TODO - charset?
+            out.write(responseHeaders.getBytes(SampleResult.DEFAULT_HTTP_ENCODING));
             out.write(CRLF_BYTES);
             out.write(res.getResponseData());
             out.flush();

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=1227014&r1=1227013&r2=1227014&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
Wed Jan  4 01:29:11 2012
@@ -100,6 +100,7 @@ import org.apache.jmeter.protocol.http.u
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.protocol.http.util.SlowHC4SSLSocketFactory;
 import org.apache.jmeter.protocol.http.util.SlowHC4SocketFactory;
+import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.property.CollectionProperty;
 import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.util.JMeterUtils;
@@ -965,7 +966,7 @@ public class HTTPHC4Impl extends HTTPHCA
                         if (contentEncoding != null) {
                             postedBody.append(new String(bos.toByteArray(), contentEncoding));
                         } else {
-                            postedBody.append(new String(bos.toByteArray()));
+                            postedBody.append(new String(bos.toByteArray(), SampleResult.DEFAULT_HTTP_ENCODING));
                         }
                         bos.close();
                     }  else {

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java?rev=1227014&r1=1227013&r2=1227014&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
Wed Jan  4 01:29:11 2012
@@ -31,6 +31,7 @@ import java.net.URLConnection;
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
 import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
+import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.property.PropertyIterator;
 
 /**
@@ -122,7 +123,7 @@ public class PostWriter {
                 postedBody.append(new String(fileMultipartEndDivider, ENCODING));
                 if(i + 1 < files.length) {
                     out.write(CRLF);
-                    postedBody.append(new String(CRLF)); // TODO - charset?
+                    postedBody.append(new String(CRLF, SampleResult.DEFAULT_HTTP_ENCODING));
                 }
             }
             // Write end of multipart

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/LoopbackHTTPSocket.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/LoopbackHTTPSocket.java?rev=1227014&r1=1227013&r2=1227014&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/LoopbackHTTPSocket.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/LoopbackHTTPSocket.java
Wed Jan  4 01:29:11 2012
@@ -27,6 +27,8 @@ import java.net.InetAddress;
 import java.net.Socket;
 import java.net.UnknownHostException;
 
+import org.apache.jmeter.samplers.SampleResult;
+
 /*
  * Socket that reads back from the output
  */
@@ -66,7 +68,7 @@ public class LoopbackHTTPSocket extends 
     private LoopbackHTTPSocket() throws IOException{
         os=new LoopbackOutputStream();
         // Preload the output so that can be read back as HTTP
-        os.write("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n".getBytes()); // TODO
- charset?
+        os.write("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n".getBytes(SampleResult.DEFAULT_HTTP_ENCODING));
     }
 
     public LoopbackHTTPSocket(String host, int port, InetAddress localAddress, int localPort,
int timeout) throws IOException {



Mime
View raw message