You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/12/24 13:48:20 UTC
svn commit: r1819220 -
/jmeter/trunk/src/components/org/apache/jmeter/extractor/BoundaryExtractor.java
Author: pmouawad
Date: Sun Dec 24 13:48:20 2017
New Revision: 1819220
URL: http://svn.apache.org/viewvc?rev=1819220&view=rev
Log:
Fix sonar issue in PR #355
Contributed by Graham Russell
This closes #362
Modified:
jmeter/trunk/src/components/org/apache/jmeter/extractor/BoundaryExtractor.java
Modified: jmeter/trunk/src/components/org/apache/jmeter/extractor/BoundaryExtractor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/extractor/BoundaryExtractor.java?rev=1819220&r1=1819219&r2=1819220&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/extractor/BoundaryExtractor.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/extractor/BoundaryExtractor.java Sun Dec 24 13:48:20 2017
@@ -113,7 +113,7 @@ public class BoundaryExtractor extends A
try {
prevCount = removePrevCount(vars, refName);
List<String> matches = extractMatches(previousResult, vars, matchNumber);
- matchCount = saveMatches(vars, refName, matchNumber, matchCount, matches);
+ matchCount = saveMatches(vars, refName, matchNumber, matches);
} catch (RuntimeException e) { // NOSONAR
if (log.isWarnEnabled()) {
log.warn("{}: Error while generating result. {}", getName(), e.toString()); // NOSONAR We don't want to be too verbose
@@ -157,17 +157,24 @@ public class BoundaryExtractor extends A
}
}
- private int saveMatches(JMeterVariables vars, String refName, int matchNumber, int matchCount, List<String> matches) {
- int localMC = matchCount;
+ /**
+ * @param vars {@link JMeterVariables}
+ * @param refName Var name
+ * @param matchNumber number of matches
+ * @param matches List of String
+ * @return 0 if there is only one match, else the number of matches, this is used to remove
+ */
+ private int saveMatches(JMeterVariables vars, String refName, int matchNumber, List<String> matches) {
+ int matchCount = 0;
if (matchNumber == 0) {
saveRandomMatch(vars, refName, matches);
} else if (matchNumber > 0) {
saveOneMatch(vars, refName, matches);
} else {
- localMC = matches.size();
+ matchCount = matches.size();
saveAllMatches(vars, refName, matches);
}
- return localMC;
+ return matchCount;
}
private void saveRandomMatch(JMeterVariables vars, String refName, List<String> matches) {