Author: sebb
Date: Tue Oct 23 10:10:01 2007
New Revision: 587559
URL: http://svn.apache.org/viewvc?rev=587559&view=rev
Log:
Use getResponseDataAsString() instead of doing own conversion
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java?rev=587559&r1=587558&r2=587559&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java
(original)
+++
jakarta/jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java
Tue Oct 23 10:10:01 2007
@@ -172,11 +172,11 @@
{
//TODO: validate contentType for reasonable types?
+ //TODO: is it really necessary to recode the data?
// NOTE: responseData encoding is server specific
// Therefore we do byte -> unicode -> byte conversion
// to ensure UTF-8 encoding as required by XPathUtil
- String unicodeData = new String(result.getResponseData(),
- result.getDataEncoding());
+ String unicodeData = result.getResponseDataAsString();
// convert unicode String -> UTF-8 bytes
byte[] utf8data = unicodeData.getBytes("UTF-8"); // $NON-NLS-1$
ByteArrayInputStream in = new ByteArrayInputStream(utf8data);
Modified:
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java?rev=587559&r1=587558&r2=587559&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java
(original)
+++
jakarta/jmeter/trunk/src/functions/org/apache/jmeter/functions/RegexFunction.java
Tue Oct 23 10:10:01 2007
@@ -137,8 +137,7 @@
List collectAllMatches = new ArrayList();
try {
PatternMatcher matcher = JMeterUtils.getMatcher();
- String responseText = new
String(previousResult.getResponseData(),
- previousResult.getDataEncoding()); // Bug 37140
+ String responseText =
previousResult.getResponseDataAsString();
PatternMatcherInput input = new
PatternMatcherInput(responseText);
while (matcher.contains(input, searchPattern)) {
MatchResult match = matcher.getMatch();
@@ -146,9 +145,6 @@
}
} catch (NumberFormatException e) {//TODO: can this occur?
log.error("", e); //$NON-NLS-1$
- return defaultValue;
- } catch (UnsupportedEncodingException e) {
- log.error("Can't convert ResponseData", e);
return defaultValue;
} finally {
vars.put(name + "_matchNr", "" +
collectAllMatches.size()); //$NON-NLS-1$ //$NON-NLS-2$
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java?rev=587559&r1=587558&r2=587559&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
Tue Oct 23 10:10:01 2007
@@ -79,10 +79,7 @@
}
List potentialLinks = new ArrayList();
String responseText = ""; // $NON-NLS-1$
- try {
- responseText = new String(result.getResponseData(),
result.getDataEncoding());
- } catch (UnsupportedEncodingException e) {
- }
+ responseText = result.getResponseDataAsString();
Document html;
int index = responseText.indexOf("<"); // $NON-NLS-1$
if (index == -1) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]