You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2018/02/12 17:16:33 UTC
svn commit: r1824035 - in /jmeter/trunk/src/core/org/apache/jmeter:
control/GenericController.java engine/util/CompoundVariable.java
engine/util/FunctionParser.java gui/MainFrame.java
samplers/BatchSampleSender.java samplers/StatisticalSampleSender.java
Author: fschumacher
Date: Mon Feb 12 17:16:33 2018
New Revision: 1824035
URL: http://svn.apache.org/viewvc?rev=1824035&view=rev
Log:
Use isEmpty instead of comparing to size
Part of #356 on Github. Based on contribution by Graham Russell (graham at ham1.co.uk)
Modified:
jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java
jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java
jmeter/trunk/src/core/org/apache/jmeter/engine/util/FunctionParser.java
jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java
jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java
jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java
Modified: jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java?rev=1824035&r1=1824034&r2=1824035&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java Mon Feb 12 17:16:33 2018
@@ -313,7 +313,7 @@ public class GenericController extends A
if (current < subControllersAndSamplers.size()) {
return subControllersAndSamplers.get(current);
}
- if (subControllersAndSamplers.size() == 0) {
+ if (subControllersAndSamplers.isEmpty()) {
setDone(true);
throw new NextIsNullException();
}
Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java?rev=1824035&r1=1824034&r2=1824035&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java Mon Feb 12 17:16:33 2018
@@ -79,11 +79,10 @@ public class CompoundVariable implements
}
}
- final int functionCount = functions.size();
- if (functionCount == 0) {
+ if (functions.isEmpty()) {
log.warn("Did not find any functions");
} else {
- log.debug("Function count: {}", functionCount);
+ log.debug("Function count: {}", functions.size());
}
} catch (Exception err) {
log.error("Exception occurred in static initialization of CompoundVariable.", err);
@@ -126,7 +125,7 @@ public class CompoundVariable implements
/** {@inheritDoc} */
@Override
public String execute(SampleResult previousResult, Sampler currentSampler) {
- if (compiledComponents == null || compiledComponents.size() == 0) {
+ if (compiledComponents == null || compiledComponents.isEmpty()) {
return ""; // $NON-NLS-1$
}
@@ -180,7 +179,7 @@ public class CompoundVariable implements
}
compiledComponents = functionParser.compileString(parameters);
- if (compiledComponents.size() > 1 || !(compiledComponents.get(0) instanceof String)) {
+ if (!compiledComponents.isEmpty() || !(compiledComponents.get(0) instanceof String)) {
hasFunction = true;
}
permanentResults = null; // To be calculated and cached on first execution
Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/util/FunctionParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/util/FunctionParser.java?rev=1824035&r1=1824034&r2=1824035&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/util/FunctionParser.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/util/FunctionParser.java Mon Feb 12 17:16:33 2018
@@ -95,7 +95,7 @@ class FunctionParser {
result.clear();
result.add(value);
}
- if (result.size() == 0) {
+ if (result.isEmpty()) {
result.add("");
}
return result;
Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java?rev=1824035&r1=1824034&r2=1824035&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java Mon Feb 12 17:16:33 2018
@@ -468,7 +468,7 @@ public class MainFrame extends JFrame im
@Override
public void testEnded(String host) {
hosts.remove(host);
- if (hosts.size() == 0) {
+ if (hosts.isEmpty()) {
runningIndicator.setIcon(stoppedIcon);
JMeterContextService.endTest();
computeTestDurationTimer.stop();
Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java?rev=1824035&r1=1824034&r2=1824035&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/BatchSampleSender.java Mon Feb 12 17:16:33 2018
@@ -120,7 +120,7 @@ public class BatchSampleSender extends A
public void testEnded(String host) {
log.info("Test Ended on {}", host);
try {
- if (sampleStore.size() != 0) {
+ if (!sampleStore.isEmpty()) {
listener.processBatch(sampleStore);
sampleStore.clear();
}
Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java?rev=1824035&r1=1824034&r2=1824035&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/StatisticalSampleSender.java Mon Feb 12 17:16:33 2018
@@ -122,7 +122,7 @@ public class StatisticalSampleSender ext
public void testEnded(String host) {
log.info("Test Ended on {}", host);
try {
- if (sampleStore.size() != 0) {
+ if (!sampleStore.isEmpty()) {
sendBatch();
}
listener.testEnded(host);
@@ -189,7 +189,7 @@ public class StatisticalSampleSender ext
}
private void sendBatch() throws RemoteException {
- if (sampleStore.size() > 0) {
+ if (!sampleStore.isEmpty()) {
listener.processBatch(sampleStore);
sampleStore.clear();
sampleTable.clear();