You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2013/02/26 19:25:39 UTC

svn commit: r1450336 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java

Author: sebb
Date: Tue Feb 26 18:25:39 2013
New Revision: 1450336

URL: http://svn.apache.org/r1450336
Log:
View Results Tree have a lot of Garbage characters if html page uses double-byte charset
Preserve original case of content-type
Bugzilla Id: 54585

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java?rev=1450336&r1=1450335&r2=1450336&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java Tue Feb 26 18:25:39 2013
@@ -210,12 +210,12 @@ public class HTTPSampleResult extends Sa
         if (super.getDataEncodingNoDefault() == null && getContentType().startsWith("text/html")){ // $NON-NLS-1$
             byte[] bytes=getResponseData();
             // get the start of the file
-            String prefix = new String(bytes, 0, Math.min(bytes.length, 2000), 
-                                       Charset.forName(DEFAULT_HTTP_ENCODING))
-                                .toLowerCase(java.util.Locale.ENGLISH);
+            String prefix = new String(bytes, 0, Math.min(bytes.length, 2000), Charset.forName(DEFAULT_HTTP_ENCODING));
+            // Preserve original case
+            String matchAgainst = prefix.toLowerCase(java.util.Locale.ENGLISH);
             // Extract the content-type if present
             final String METATAG = "<meta http-equiv=\"content-type\" content=\""; // $NON-NLS-1$
-            int tagstart=prefix.indexOf(METATAG);
+            int tagstart=matchAgainst.indexOf(METATAG);
             if (tagstart!=-1){
                 tagstart += METATAG.length();
                 int tagend = prefix.indexOf('\"', tagstart); // $NON-NLS-1$