Author: agomes Date: Tue Jan 17 21:14:44 2017 New Revision: 1779267 URL: http://svn.apache.org/viewvc?rev=1779267&view=rev Log: This closes #243 : Fix warning prone default charset in SampleResult.java
Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=1779267&r1=1779266&r2=1779267&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java Tue Jan 17 21:14:44 2017 @@ -711,7 +711,7 @@ public class SampleResult implements Ser responseData = response.getBytes(getDataEncodingWithDefault()); } catch (UnsupportedEncodingException e) { log.warn("Could not convert string, using default encoding. "+e.getLocalizedMessage()); - responseData = response.getBytes(); // N.B. default charset is used deliberately here + responseData = response.getBytes(Charset.defaultCharset()); // N.B. default charset is used deliberately here } } @@ -731,7 +731,7 @@ public class SampleResult implements Ser } catch (UnsupportedEncodingException e) { log.warn("Could not convert string using '"+encodeUsing+ "', using default encoding: "+DEFAULT_CHARSET,e); - responseData = response.getBytes(); // N.B. default charset is used deliberately here + responseData = response.getBytes(Charset.defaultCharset()); // N.B. default charset is used deliberately here setDataEncoding(DEFAULT_CHARSET); } } @@ -763,7 +763,7 @@ public class SampleResult implements Ser return responseDataAsString; } catch (UnsupportedEncodingException e) { log.warn("Using platform default as "+getDataEncodingWithDefault()+" caused "+e); - return new String(responseData); // N.B. default charset is used deliberately here + return new String(responseData,Charset.defaultCharset()); // N.B. default charset is used deliberately here } }