View | Details | Raw Unified | Return to bug 59722
Collapse All | Expand All

(-)a/src/components/org/apache/jmeter/assertions/HTMLAssertion.java (-2 / +3 lines)
Lines 25-30 import java.io.IOException; Link Here
25
import java.io.PrintWriter;
25
import java.io.PrintWriter;
26
import java.io.Serializable;
26
import java.io.Serializable;
27
import java.io.StringWriter;
27
import java.io.StringWriter;
28
import java.nio.charset.StandardCharsets;
28
import java.text.MessageFormat;
29
import java.text.MessageFormat;
29
30
30
import org.apache.commons.io.IOUtils;
31
import org.apache.commons.io.IOUtils;
Lines 101-108 public class HTMLAssertion extends AbstractTestElement implements Serializable, Link Here
101
                log.debug("xml mode: " + isXML());
102
                log.debug("xml mode: " + isXML());
102
            }
103
            }
103
            tidy = new Tidy();
104
            tidy = new Tidy();
104
            tidy.setInputEncoding("UTF8");
105
            tidy.setInputEncoding(StandardCharsets.UTF_8.name());
105
            tidy.setOutputEncoding("UTF8");
106
            tidy.setOutputEncoding(StandardCharsets.UTF_8.name());
106
            tidy.setQuiet(false);
107
            tidy.setQuiet(false);
107
            tidy.setShowWarnings(true);
108
            tidy.setShowWarnings(true);
108
            tidy.setOnlyErrors(isErrorsOnly());
109
            tidy.setOnlyErrors(isErrorsOnly());
(-)a/src/components/org/apache/jmeter/assertions/XPathAssertion.java (-2 / +3 lines)
Lines 21-26 package org.apache.jmeter.assertions; Link Here
21
import java.io.ByteArrayInputStream;
21
import java.io.ByteArrayInputStream;
22
import java.io.IOException;
22
import java.io.IOException;
23
import java.io.Serializable;
23
import java.io.Serializable;
24
import java.nio.charset.StandardCharsets;
24
25
25
import javax.xml.parsers.ParserConfigurationException;
26
import javax.xml.parsers.ParserConfigurationException;
26
27
Lines 80-87 public class XPathAssertion extends AbstractScopedAssertion implements Serializa Link Here
80
        try {
81
        try {
81
            if (isScopeVariable()){
82
            if (isScopeVariable()){
82
                String inputString=getThreadContext().getVariables().get(getVariableName());
83
                String inputString=getThreadContext().getVariables().get(getVariableName());
83
                if(!StringUtils.isEmpty(inputString)) {
84
                if (!StringUtils.isEmpty(inputString)) {
84
                    responseData = inputString.getBytes("UTF-8");
85
                    responseData = inputString.getBytes(StandardCharsets.UTF_8);
85
                } 
86
                } 
86
            } else {
87
            } else {
87
                responseData = response.getResponseData();
88
                responseData = response.getResponseData();
(-)a/src/components/org/apache/jmeter/extractor/XPathExtractor.java (-3 / +3 lines)
Lines 20-26 package org.apache.jmeter.extractor; Link Here
20
import java.io.ByteArrayInputStream;
20
import java.io.ByteArrayInputStream;
21
import java.io.IOException;
21
import java.io.IOException;
22
import java.io.Serializable;
22
import java.io.Serializable;
23
import java.io.UnsupportedEncodingException;
23
import java.nio.charset.StandardCharsets;
24
import java.util.ArrayList;
24
import java.util.ArrayList;
25
import java.util.List;
25
import java.util.List;
26
26
Lines 287-293 public class XPathExtractor extends AbstractScopedTestElement implements Link Here
287
     *
287
     *
288
     */
288
     */
289
    private Document parseResponse(String unicodeData)
289
    private Document parseResponse(String unicodeData)
290
      throws UnsupportedEncodingException, IOException, ParserConfigurationException,SAXException,TidyException
290
      throws IOException, ParserConfigurationException,SAXException,TidyException
291
    {
291
    {
292
      //TODO: validate contentType for reasonable types?
292
      //TODO: validate contentType for reasonable types?
293
293
Lines 295-301 public class XPathExtractor extends AbstractScopedTestElement implements Link Here
295
      //       Therefore we do byte -> unicode -> byte conversion
295
      //       Therefore we do byte -> unicode -> byte conversion
296
      //       to ensure UTF-8 encoding as required by XPathUtil
296
      //       to ensure UTF-8 encoding as required by XPathUtil
297
      // convert unicode String -> UTF-8 bytes
297
      // convert unicode String -> UTF-8 bytes
298
      byte[] utf8data = unicodeData.getBytes("UTF-8"); // $NON-NLS-1$
298
      byte[] utf8data = unicodeData.getBytes(StandardCharsets.UTF_8);
299
      ByteArrayInputStream in = new ByteArrayInputStream(utf8data);
299
      ByteArrayInputStream in = new ByteArrayInputStream(utf8data);
300
      boolean isXML = JOrphanUtils.isXML(utf8data);
300
      boolean isXML = JOrphanUtils.isXML(utf8data);
301
      // this method assumes UTF-8 input data
301
      // this method assumes UTF-8 input data
(-)a/src/components/org/apache/jmeter/visualizers/RenderAsXPath.java (-3 / +3 lines)
Lines 25-31 import java.awt.event.ActionEvent; Link Here
25
import java.awt.event.ActionListener;
25
import java.awt.event.ActionListener;
26
import java.io.ByteArrayInputStream;
26
import java.io.ByteArrayInputStream;
27
import java.io.IOException;
27
import java.io.IOException;
28
import java.io.UnsupportedEncodingException;
28
import java.nio.charset.StandardCharsets;
29
import java.util.ArrayList;
29
import java.util.ArrayList;
30
import java.util.List;
30
import java.util.List;
31
31
Lines 160-166 public class RenderAsXPath implements ResultRenderer, ActionListener { Link Here
160
     *
160
     *
161
     */
161
     */
162
    private Document parseResponse(String unicodeData, XPathExtractor extractor)
162
    private Document parseResponse(String unicodeData, XPathExtractor extractor)
163
      throws UnsupportedEncodingException, IOException, ParserConfigurationException,SAXException,TidyException
163
      throws IOException, ParserConfigurationException,SAXException,TidyException
164
    {
164
    {
165
      //TODO: validate contentType for reasonable types?
165
      //TODO: validate contentType for reasonable types?
166
166
Lines 168-174 public class RenderAsXPath implements ResultRenderer, ActionListener { Link Here
168
      //       Therefore we do byte -> unicode -> byte conversion
168
      //       Therefore we do byte -> unicode -> byte conversion
169
      //       to ensure UTF-8 encoding as required by XPathUtil
169
      //       to ensure UTF-8 encoding as required by XPathUtil
170
      // convert unicode String -> UTF-8 bytes
170
      // convert unicode String -> UTF-8 bytes
171
      byte[] utf8data = unicodeData.getBytes("UTF-8"); // $NON-NLS-1$
171
      byte[] utf8data = unicodeData.getBytes(StandardCharsets.UTF_8);
172
      ByteArrayInputStream in = new ByteArrayInputStream(utf8data);
172
      ByteArrayInputStream in = new ByteArrayInputStream(utf8data);
173
      boolean isXML = JOrphanUtils.isXML(utf8data);
173
      boolean isXML = JOrphanUtils.isXML(utf8data);
174
      // this method assumes UTF-8 input data
174
      // this method assumes UTF-8 input data
(-)a/src/components/org/apache/jmeter/visualizers/backend/graphite/GraphiteMetricsSender.java (-1 / +3 lines)
Lines 18-23 Link Here
18
18
19
package org.apache.jmeter.visualizers.backend.graphite;
19
package org.apache.jmeter.visualizers.backend.graphite;
20
20
21
import java.nio.charset.StandardCharsets;
22
21
/**
23
/**
22
 * @since 2.13
24
 * @since 2.13
23
 */
25
 */
Lines 26-32 interface GraphiteMetricsSender { Link Here
26
    int SOCKET_TIMEOUT = 1000;
28
    int SOCKET_TIMEOUT = 1000;
27
29
28
30
29
    String CHARSET_NAME = "UTF-8"; //$NON-NLS-1$
31
    String CHARSET_NAME = StandardCharsets.UTF_8.name();
30
32
31
    final class MetricTuple {
33
    final class MetricTuple {
32
        String name;
34
        String name;
(-)a/src/core/org/apache/jmeter/reporters/ResultCollector.java (-1 / +2 lines)
Lines 31-36 import java.io.OutputStreamWriter; Link Here
31
import java.io.PrintWriter;
31
import java.io.PrintWriter;
32
import java.io.RandomAccessFile;
32
import java.io.RandomAccessFile;
33
import java.io.Serializable;
33
import java.io.Serializable;
34
import java.nio.charset.StandardCharsets;
34
import java.util.HashMap;
35
import java.util.HashMap;
35
import java.util.Map;
36
import java.util.Map;
36
37
Lines 470-476 public class ResultCollector extends AbstractListenerElement implements SampleLi Link Here
470
                }
471
                }
471
            }
472
            }
472
            writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(filename,
473
            writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(filename,
473
                    trimmed)), SaveService.getFileEncoding("UTF-8")), SAVING_AUTOFLUSH); // $NON-NLS-1$
474
                    trimmed)), SaveService.getFileEncoding(StandardCharsets.UTF_8.name())), SAVING_AUTOFLUSH); // $NON-NLS-1$
474
            log.debug("Opened file: "+filename);
475
            log.debug("Opened file: "+filename);
475
            files.put(filename, new FileEntry(writer, saveConfig));
476
            files.put(filename, new FileEntry(writer, saveConfig));
476
        } else {
477
        } else {
(-)a/src/core/org/apache/jmeter/samplers/SampleResult.java (-1 / +2 lines)
Lines 23-28 import java.io.UnsupportedEncodingException; Link Here
23
import java.net.HttpURLConnection;
23
import java.net.HttpURLConnection;
24
import java.net.URL;
24
import java.net.URL;
25
import java.nio.charset.Charset;
25
import java.nio.charset.Charset;
26
import java.nio.charset.StandardCharsets;
26
import java.util.ArrayList;
27
import java.util.ArrayList;
27
import java.util.HashSet;
28
import java.util.HashSet;
28
import java.util.List;
29
import java.util.List;
Lines 54-60 public class SampleResult implements Serializable, Cloneable, Searchable { Link Here
54
     * The default encoding to be used if not overridden.
55
     * The default encoding to be used if not overridden.
55
     * The value is ISO-8859-1.
56
     * The value is ISO-8859-1.
56
     */
57
     */
57
    public static final String DEFAULT_HTTP_ENCODING = "ISO-8859-1";  // $NON-NLS-1$
58
    public static final String DEFAULT_HTTP_ENCODING = StandardCharsets.ISO_8859_1.name();
58
59
59
    // Bug 33196 - encoding ISO-8859-1 is only suitable for Western countries
60
    // Bug 33196 - encoding ISO-8859-1 is only suitable for Western countries
60
    // However the suggested System.getProperty("file.encoding") is Cp1252 on
61
    // However the suggested System.getProperty("file.encoding") is Cp1252 on
(-)a/src/core/org/apache/jmeter/save/CSVSaveService.java (-1 / +2 lines)
Lines 25-30 import java.io.FileWriter; Link Here
25
import java.io.IOException;
25
import java.io.IOException;
26
import java.io.InputStreamReader;
26
import java.io.InputStreamReader;
27
import java.io.StringReader;
27
import java.io.StringReader;
28
import java.nio.charset.StandardCharsets;
28
import java.text.ParseException;
29
import java.text.ParseException;
29
import java.text.SimpleDateFormat;
30
import java.text.SimpleDateFormat;
30
import java.util.ArrayList;
31
import java.util.ArrayList;
Lines 138-144 public final class CSVSaveService { Link Here
138
        final boolean successOnly = resultCollector.isSuccessOnlyLogging();
139
        final boolean successOnly = resultCollector.isSuccessOnlyLogging();
139
        try {
140
        try {
140
            dataReader = new BufferedReader(new InputStreamReader(
141
            dataReader = new BufferedReader(new InputStreamReader(
141
                    new FileInputStream(filename), SaveService.getFileEncoding("UTF-8"))); 
142
                    new FileInputStream(filename), SaveService.getFileEncoding(StandardCharsets.UTF_8.name())));
142
            dataReader.mark(400);// Enough to read the header column names
143
            dataReader.mark(400);// Enough to read the header column names
143
            // Get the first line, and see if it is the header
144
            // Get the first line, and see if it is the header
144
            String line = dataReader.readLine();
145
            String line = dataReader.readLine();
(-)a/src/core/org/apache/jmeter/save/converters/ConversionHelp.java (-1 / +2 lines)
Lines 24-29 package org.apache.jmeter.save.converters; Link Here
24
import java.io.UnsupportedEncodingException;
24
import java.io.UnsupportedEncodingException;
25
import java.net.URLDecoder;
25
import java.net.URLDecoder;
26
import java.net.URLEncoder;
26
import java.net.URLEncoder;
27
import java.nio.charset.StandardCharsets;
27
import java.util.HashMap;
28
import java.util.HashMap;
28
import java.util.Map;
29
import java.util.Map;
29
30
Lines 44-50 import com.thoughtworks.xstream.io.HierarchicalStreamWriter; Link Here
44
public class ConversionHelp {
45
public class ConversionHelp {
45
    private static final Logger log = LoggingManager.getLoggerForClass();
46
    private static final Logger log = LoggingManager.getLoggerForClass();
46
47
47
    private static final String CHAR_SET = "UTF-8"; //$NON-NLS-1$
48
    private static final String CHAR_SET = StandardCharsets.UTF_8.name();
48
49
49
    // Attributes for TestElement and TestElementProperty
50
    // Attributes for TestElement and TestElementProperty
50
    // Must all be unique
51
    // Must all be unique
(-)a/src/core/org/apache/jmeter/util/XPathUtil.java (-2 / +3 lines)
Lines 25-30 import java.io.OutputStream; Link Here
25
import java.io.PrintWriter;
25
import java.io.PrintWriter;
26
import java.io.StringReader;
26
import java.io.StringReader;
27
import java.io.StringWriter;
27
import java.io.StringWriter;
28
import java.nio.charset.StandardCharsets;
28
import java.util.List;
29
import java.util.List;
29
30
30
import javax.xml.parsers.DocumentBuilder;
31
import javax.xml.parsers.DocumentBuilder;
Lines 219-226 public class XPathUtil { Link Here
219
     */
220
     */
220
    public static Tidy makeTidyParser(boolean quiet, boolean showWarnings, boolean isXml, StringWriter stringWriter) {
221
    public static Tidy makeTidyParser(boolean quiet, boolean showWarnings, boolean isXml, StringWriter stringWriter) {
221
        Tidy tidy = new Tidy();
222
        Tidy tidy = new Tidy();
222
        tidy.setInputEncoding("UTF8");
223
        tidy.setInputEncoding(StandardCharsets.UTF_8.name());
223
        tidy.setOutputEncoding("UTF8");
224
        tidy.setOutputEncoding(StandardCharsets.UTF_8.name());
224
        tidy.setQuiet(quiet);
225
        tidy.setQuiet(quiet);
225
        tidy.setShowWarnings(showWarnings);
226
        tidy.setShowWarnings(showWarnings);
226
        tidy.setMakeClean(true);
227
        tidy.setMakeClean(true);
(-)a/src/functions/org/apache/jmeter/functions/UrlDecode.java (-1 / +2 lines)
Lines 21-26 package org.apache.jmeter.functions; Link Here
21
21
22
import java.io.UnsupportedEncodingException;
22
import java.io.UnsupportedEncodingException;
23
import java.net.URLDecoder;
23
import java.net.URLDecoder;
24
import java.nio.charset.StandardCharsets;
24
import java.util.Collection;
25
import java.util.Collection;
25
import java.util.LinkedList;
26
import java.util.LinkedList;
26
import java.util.List;
27
import java.util.List;
Lines 37-43 import org.apache.jmeter.util.JMeterUtils; Link Here
37
 */
38
 */
38
public class UrlDecode extends AbstractFunction {
39
public class UrlDecode extends AbstractFunction {
39
40
40
    private static final String CHARSET_ENCODING = "UTF-8"; //$NON-NLS-1$
41
    private static final String CHARSET_ENCODING = StandardCharsets.UTF_8.name();
41
    
42
    
42
    private static final List<String> desc = new LinkedList<>();
43
    private static final List<String> desc = new LinkedList<>();
43
44
(-)a/src/functions/org/apache/jmeter/functions/UrlEncode.java (-1 / +2 lines)
Lines 21-26 package org.apache.jmeter.functions; Link Here
21
21
22
import java.io.UnsupportedEncodingException;
22
import java.io.UnsupportedEncodingException;
23
import java.net.URLEncoder;
23
import java.net.URLEncoder;
24
import java.nio.charset.StandardCharsets;
24
import java.util.Collection;
25
import java.util.Collection;
25
import java.util.LinkedList;
26
import java.util.LinkedList;
26
import java.util.List;
27
import java.util.List;
Lines 37-43 import org.apache.jmeter.util.JMeterUtils; Link Here
37
 */
38
 */
38
public class UrlEncode extends AbstractFunction {
39
public class UrlEncode extends AbstractFunction {
39
40
40
    private static final String CHARSET_ENCODING = "UTF-8"; //$NON-NLS-1$
41
    private static final String CHARSET_ENCODING = StandardCharsets.UTF_8.name();
41
    
42
    
42
    private static final List<String> desc = new LinkedList<>();
43
    private static final List<String> desc = new LinkedList<>();
43
44
(-)a/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java (-1 / +2 lines)
Lines 25-30 import java.io.IOException; Link Here
25
import java.net.Socket;
25
import java.net.Socket;
26
import java.net.URI;
26
import java.net.URI;
27
import java.net.URISyntaxException;
27
import java.net.URISyntaxException;
28
import java.nio.charset.StandardCharsets;
28
import java.util.HashMap;
29
import java.util.HashMap;
29
import java.util.concurrent.TimeUnit;
30
import java.util.concurrent.TimeUnit;
30
31
Lines 57-63 import org.apache.oro.text.regex.Perl5Matcher; Link Here
57
public class HttpMirrorThread implements Runnable {
58
public class HttpMirrorThread implements Runnable {
58
    private static final Logger log = LoggingManager.getLoggerForClass();
59
    private static final Logger log = LoggingManager.getLoggerForClass();
59
60
60
    private static final String ISO_8859_1 = "ISO-8859-1"; //$NON-NLS-1$
61
    private static final String ISO_8859_1 = StandardCharsets.ISO_8859_1.name();
61
    private static final byte[] CRLF = { 0x0d, 0x0a };
62
    private static final byte[] CRLF = { 0x0d, 0x0a };
62
63
63
    private static final String REDIRECT = "redirect"; //$NON-NLS-1$
64
    private static final String REDIRECT = "redirect"; //$NON-NLS-1$
(-)a/src/protocol/http/org/apache/jmeter/protocol/http/parser/HtmlParsingUtils.java (-15 / +14 lines)
Lines 23-28 import java.io.UnsupportedEncodingException; Link Here
23
import java.net.MalformedURLException;
23
import java.net.MalformedURLException;
24
import java.net.URL;
24
import java.net.URL;
25
import java.net.URLDecoder;
25
import java.net.URLDecoder;
26
import java.nio.charset.StandardCharsets;
26
import java.util.LinkedList;
27
import java.util.LinkedList;
27
import java.util.List;
28
import java.util.List;
28
29
Lines 74-80 public final class HtmlParsingUtils { Link Here
74
    {
75
    {
75
        String query = null;
76
        String query = null;
76
        try {
77
        try {
77
            query = URLDecoder.decode(newLink.getQueryString(), "UTF-8"); // $NON-NLS-1$
78
            query = URLDecoder.decode(newLink.getQueryString(), StandardCharsets.UTF_8.name());
78
        } catch (UnsupportedEncodingException e) {
79
        } catch (UnsupportedEncodingException e) {
79
            // UTF-8 unsupported? You must be joking!
80
            // UTF-8 unsupported? You must be joking!
80
            log.error("UTF-8 encoding not supported!");
81
            log.error("UTF-8 encoding not supported!");
Lines 204-211 public final class HtmlParsingUtils { Link Here
204
    public static Tidy getParser() {
205
    public static Tidy getParser() {
205
        log.debug("Start : getParser1");
206
        log.debug("Start : getParser1");
206
        Tidy tidy = new Tidy();
207
        Tidy tidy = new Tidy();
207
        tidy.setInputEncoding("UTF8");
208
        tidy.setInputEncoding(StandardCharsets.UTF_8.name());
208
        tidy.setOutputEncoding("UTF8");
209
        tidy.setOutputEncoding(StandardCharsets.UTF_8.name());
209
        tidy.setQuiet(true);
210
        tidy.setQuiet(true);
210
        tidy.setShowWarnings(false);
211
        tidy.setShowWarnings(false);
211
212
Lines 228-248 public final class HtmlParsingUtils { Link Here
228
    public static Node getDOM(String text) {
229
    public static Node getDOM(String text) {
229
        log.debug("Start : getDOM1");
230
        log.debug("Start : getDOM1");
230
231
231
        try {
232
        Node node = getParser()
232
            Node node = getParser().parseDOM(new ByteArrayInputStream(text.getBytes("UTF-8")), null);// $NON-NLS-1$
233
                .parseDOM(
234
                        new ByteArrayInputStream(
235
                                text.getBytes(StandardCharsets.UTF_8)), null);
233
236
234
            if (log.isDebugEnabled()) {
237
        if (log.isDebugEnabled()) {
235
                log.debug("node : " + node);
238
            log.debug("node : " + node);
236
            }
239
        }
237
240
238
            log.debug("End : getDOM1");
241
        log.debug("End : getDOM1");
242
243
        return node;
239
244
240
            return node;
241
        } catch (UnsupportedEncodingException e) {
242
            log.error("getDOM1 : Unsupported encoding exception - " + e);
243
            log.debug("End : getDOM1");
244
            throw new RuntimeException("UTF-8 encoding failed", e);
245
        }
246
    }
245
    }
247
246
248
    public static Document createEmptyDoc() {
247
    public static Document createEmptyDoc() {
(-)a/src/protocol/http/org/apache/jmeter/protocol/http/parser/JTidyHTMLParser.java (-1 / +2 lines)
Lines 21-26 package org.apache.jmeter.protocol.http.parser; Link Here
21
import java.io.ByteArrayInputStream;
21
import java.io.ByteArrayInputStream;
22
import java.net.MalformedURLException;
22
import java.net.MalformedURLException;
23
import java.net.URL;
23
import java.net.URL;
24
import java.nio.charset.StandardCharsets;
24
import java.util.Iterator;
25
import java.util.Iterator;
25
26
26
import org.apache.commons.lang3.StringUtils;
27
import org.apache.commons.lang3.StringUtils;
Lines 211-217 class JTidyHTMLParser extends HTMLParser { Link Here
211
        log.debug("Start : getParser");
212
        log.debug("Start : getParser");
212
        Tidy tidy = new Tidy();
213
        Tidy tidy = new Tidy();
213
        tidy.setInputEncoding(encoding);
214
        tidy.setInputEncoding(encoding);
214
        tidy.setOutputEncoding("UTF8");
215
        tidy.setOutputEncoding(StandardCharsets.UTF_8.name());
215
        tidy.setQuiet(true);
216
        tidy.setQuiet(true);
216
        tidy.setShowWarnings(false);
217
        tidy.setShowWarnings(false);
217
        if (log.isDebugEnabled()) {
218
        if (log.isDebugEnabled()) {
(-)a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java (-1 / +2 lines)
Lines 27-32 import java.io.InputStream; Link Here
27
import java.io.OutputStream;
27
import java.io.OutputStream;
28
import java.io.UnsupportedEncodingException;
28
import java.io.UnsupportedEncodingException;
29
import java.net.URLConnection;
29
import java.net.URLConnection;
30
import java.nio.charset.StandardCharsets;
30
31
31
import org.apache.jmeter.protocol.http.util.HTTPArgument;
32
import org.apache.jmeter.protocol.http.util.HTTPArgument;
32
import org.apache.jmeter.protocol.http.util.HTTPConstants;
33
import org.apache.jmeter.protocol.http.util.HTTPConstants;
Lines 49-55 public class PostWriter { Link Here
49
50
50
    private static final byte[] CRLF = { 0x0d, 0x0A };
51
    private static final byte[] CRLF = { 0x0d, 0x0A };
51
52
52
    public static final String ENCODING = "ISO-8859-1"; // $NON-NLS-1$
53
    public static final String ENCODING = StandardCharsets.ISO_8859_1.name();
53
54
54
    /** The form data that is going to be sent as url encoded */
55
    /** The form data that is going to be sent as url encoded */
55
    protected byte[] formDataUrlEncoded;
56
    protected byte[] formDataUrlEncoded;
(-)a/src/protocol/http/org/apache/jmeter/protocol/http/util/ConversionUtils.java (-1 / +2 lines)
Lines 25-30 import java.net.URL; Link Here
25
import java.net.URLDecoder;
25
import java.net.URLDecoder;
26
import java.nio.charset.Charset;
26
import java.nio.charset.Charset;
27
import java.nio.charset.IllegalCharsetNameException;
27
import java.nio.charset.IllegalCharsetNameException;
28
import java.nio.charset.StandardCharsets;
28
import java.util.ArrayList;
29
import java.util.ArrayList;
29
import java.util.List;
30
import java.util.List;
30
import java.util.StringTokenizer;
31
import java.util.StringTokenizer;
Lines 127-133 public class ConversionUtils { Link Here
127
     * @throws Exception when given <code>url</code> leads to a malformed URL or URI
128
     * @throws Exception when given <code>url</code> leads to a malformed URL or URI
128
     */
129
     */
129
    public static String escapeIllegalURLCharacters(String url) throws Exception{
130
    public static String escapeIllegalURLCharacters(String url) throws Exception{
130
        String decodeUrl = URLDecoder.decode(url,"UTF-8");
131
        String decodeUrl = URLDecoder.decode(url,StandardCharsets.UTF_8.name());
131
        URL urlString = new URL(decodeUrl);
132
        URL urlString = new URL(decodeUrl);
132
        URI uri = new URI(urlString.getProtocol(), urlString.getUserInfo(), urlString.getHost(), urlString.getPort(), urlString.getPath(), urlString.getQuery(), urlString.getRef());
133
        URI uri = new URI(urlString.getProtocol(), urlString.getUserInfo(), urlString.getHost(), urlString.getPort(), urlString.getPath(), urlString.getQuery(), urlString.getRef());
133
        return uri.toString();
134
        return uri.toString();
(-)a/src/protocol/http/org/apache/jmeter/protocol/http/util/EncoderCache.java (-2 / +3 lines)
Lines 20-25 package org.apache.jmeter.protocol.http.util; Link Here
20
20
21
import java.io.UnsupportedEncodingException;
21
import java.io.UnsupportedEncodingException;
22
import java.net.URLEncoder;
22
import java.net.URLEncoder;
23
import java.nio.charset.StandardCharsets;
23
24
24
import org.apache.oro.util.Cache;
25
import org.apache.oro.util.Cache;
25
import org.apache.oro.util.CacheLRU;
26
import org.apache.oro.util.CacheLRU;
Lines 27-33 import org.apache.oro.util.CacheLRU; Link Here
27
public class EncoderCache {
28
public class EncoderCache {
28
29
29
    /** The encoding which should be usd for URLs, according to HTTP specification */
30
    /** The encoding which should be usd for URLs, according to HTTP specification */
30
    public static final String URL_ARGUMENT_ENCODING = "UTF-8";
31
    public static final String URL_ARGUMENT_ENCODING = StandardCharsets.UTF_8.name();
31
32
32
    private Cache cache;
33
    private Cache cache;
33
34
Lines 48-54 public class EncoderCache { Link Here
48
        } catch (UnsupportedEncodingException e) {
49
        } catch (UnsupportedEncodingException e) {
49
            // This can't happen (how should utf8 not be supported!?!),
50
            // This can't happen (how should utf8 not be supported!?!),
50
            // so just throw an Error:
51
            // so just throw an Error:
51
            throw new Error("Should not happen: " + e.toString());
52
            throw new Error("Should not happen: " + e.toString(), e);
52
        }
53
        }
53
    }
54
    }
54
55
(-)a/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java (-1 / +2 lines)
Lines 26-31 import java.io.IOException; Link Here
26
import java.io.InputStreamReader;
26
import java.io.InputStreamReader;
27
import java.io.UnsupportedEncodingException;
27
import java.io.UnsupportedEncodingException;
28
import java.net.URLDecoder;
28
import java.net.URLDecoder;
29
import java.nio.charset.StandardCharsets;
29
import java.util.ArrayList;
30
import java.util.ArrayList;
30
import java.util.List;
31
import java.util.List;
31
import java.util.StringTokenizer;
32
import java.util.StringTokenizer;
Lines 528-534 public class TCLogParser implements LogParser { Link Here
528
        } else {
529
        } else {
529
            if (decode) {
530
            if (decode) {
530
                try {
531
                try {
531
                    value = URLDecoder.decode(value,"UTF-8");
532
                    value = URLDecoder.decode(value, StandardCharsets.UTF_8.name());
532
                } catch (UnsupportedEncodingException e) {
533
                } catch (UnsupportedEncodingException e) {
533
                    log.warn(e.getMessage());
534
                    log.warn(e.getMessage());
534
                }
535
                }
(-)a/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java (-1 / +2 lines)
Lines 23-28 import java.awt.Component; Link Here
23
import java.io.UnsupportedEncodingException;
23
import java.io.UnsupportedEncodingException;
24
import java.net.URL;
24
import java.net.URL;
25
import java.net.URLDecoder;
25
import java.net.URLDecoder;
26
import java.nio.charset.StandardCharsets;
26
import java.util.HashMap;
27
import java.util.HashMap;
27
import java.util.LinkedHashMap;
28
import java.util.LinkedHashMap;
28
import java.util.Map;
29
import java.util.Map;
Lines 67-73 public class RequestViewHTTP implements RequestView { Link Here
67
68
68
    private static final String KEY_LABEL = "view_results_table_request_tab_http"; //$NON-NLS-1$
69
    private static final String KEY_LABEL = "view_results_table_request_tab_http"; //$NON-NLS-1$
69
    
70
    
70
    private static final String CHARSET_DECODE = "ISO-8859-1"; //$NON-NLS-1$
71
    private static final String CHARSET_DECODE = StandardCharsets.ISO_8859_1.name();
71
    
72
    
72
    private static final String PARAM_CONCATENATE = "&"; //$NON-NLS-1$
73
    private static final String PARAM_CONCATENATE = "&"; //$NON-NLS-1$
73
74
(-)a/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java (-2 / +3 lines)
Lines 22-27 import java.io.IOException; Link Here
22
import java.io.UnsupportedEncodingException;
22
import java.io.UnsupportedEncodingException;
23
import java.lang.reflect.Field;
23
import java.lang.reflect.Field;
24
import java.math.BigDecimal;
24
import java.math.BigDecimal;
25
import java.nio.charset.StandardCharsets;
25
import java.sql.CallableStatement;
26
import java.sql.CallableStatement;
26
import java.sql.Connection;
27
import java.sql.Connection;
27
import java.sql.Date;
28
import java.sql.Date;
Lines 77-83 public abstract class AbstractJDBCTestElement extends AbstractTestElement implem Link Here
77
    private static final String OUT = "OUT"; // $NON-NLS-1$
78
    private static final String OUT = "OUT"; // $NON-NLS-1$
78
79
79
    // TODO - should the encoding be configurable?
80
    // TODO - should the encoding be configurable?
80
    protected static final String ENCODING = "UTF-8"; // $NON-NLS-1$
81
    protected static final String ENCODING = StandardCharsets.UTF_8.name();
81
82
82
    // key: name (lowercase) from java.sql.Types; entry: corresponding int value
83
    // key: name (lowercase) from java.sql.Types; entry: corresponding int value
83
    private static final Map<String, Integer> mapJdbcNameToInt;
84
    private static final Map<String, Integer> mapJdbcNameToInt;
Lines 153-159 public abstract class AbstractJDBCTestElement extends AbstractTestElement implem Link Here
153
     * @throws IOException when I/O error occurs
154
     * @throws IOException when I/O error occurs
154
     * @throws UnsupportedOperationException if the user provided incorrect query type 
155
     * @throws UnsupportedOperationException if the user provided incorrect query type 
155
     */
156
     */
156
    protected byte[] execute(Connection conn) throws SQLException, UnsupportedEncodingException, IOException, UnsupportedOperationException {
157
    protected byte[] execute(Connection conn) throws SQLException, IOException, UnsupportedOperationException {
157
        log.debug("executing jdbc");
158
        log.debug("executing jdbc");
158
        Statement stmt = null;
159
        Statement stmt = null;
159
        
160
        
(-)a/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java (-10 / +2 lines)
Lines 18-24 Link Here
18
18
19
package org.apache.jmeter.protocol.ldap.sampler;
19
package org.apache.jmeter.protocol.ldap.sampler;
20
20
21
import java.io.UnsupportedEncodingException;
21
import java.nio.charset.StandardCharsets;
22
import java.util.ArrayList;
22
import java.util.ArrayList;
23
import java.util.Arrays;
23
import java.util.Arrays;
24
import java.util.Collections;
24
import java.util.Collections;
Lines 1031-1044 public class LDAPExtSampler extends AbstractSampler implements TestStateListener Link Here
1031
            return StringEscapeUtils.escapeXml10((String)value);
1031
            return StringEscapeUtils.escapeXml10((String)value);
1032
        }
1032
        }
1033
        if (value instanceof byte[]) {
1033
        if (value instanceof byte[]) {
1034
            try
1034
            return StringEscapeUtils.escapeXml10(new String((byte[])value, StandardCharsets.UTF_8));
1035
            {
1036
                return StringEscapeUtils.escapeXml10(new String((byte[])value, "UTF-8")); //$NON-NLS-1$
1037
            }
1038
            catch (UnsupportedEncodingException e)
1039
            {
1040
                log.error("this can't happen: UTF-8 character encoding not supported", e);
1041
            }
1042
        }
1035
        }
1043
        return StringEscapeUtils.escapeXml10(value.toString());
1036
        return StringEscapeUtils.escapeXml10(value.toString());
1044
    }
1037
    }
1045
- 

Return to bug 59722