Bug 42778 - Transaction Controller skips sample (NPE)

git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/branches/rel-2-2@552158 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2007-06-30 15:13:12 +00:00
parent 27121e73c4
commit 858ce03852
2 changed files with 22 additions and 2 deletions

View File

@ -39,7 +39,9 @@ public class TransactionController extends GenericController implements Controll
public Sampler next() {
// Check if transaction is done
if(transactionSampler != null && transactionSampler.isTransactionDone()) {
log.debug("End of transaction");
if (log.isDebugEnabled()) {
log.debug("End of transaction " + getName());
}
// This transaction is done
transactionSampler = null;
return null;
@ -48,7 +50,9 @@ public class TransactionController extends GenericController implements Controll
// Check if it is the start of a new transaction
if (isFirst()) // must be the start of the subtree
{
log.debug("Start of transaction");
if (log.isDebugEnabled()) {
log.debug("Start of transaction " + getName());
}
transactionSampler = new TransactionSampler(this, getName());
}
@ -61,4 +65,19 @@ public class TransactionController extends GenericController implements Controll
}
return transactionSampler;
}
protected Sampler nextIsAController(Controller controller) throws NextIsNullException {
Sampler returnValue;
Sampler sampler = controller.next();
if (sampler == null) {
currentReturnedNull(controller);
// We need to call the super.next, instead of this.next, which is done in GenericController,
// because if we call this.next(), it will return the TransactionSampler, and we do not want that.
// We need to get the next real sampler or controller
returnValue = super.next();
} else {
returnValue = sampler;
}
return returnValue;
}
}

View File

@ -51,6 +51,7 @@ public class TransactionSampler extends AbstractSampler {
public TransactionSampler(TransactionController controller, String name) {
transactionController = controller;
setName(name); // ensure name is available for debugging
transactionSampleResult = new SampleResult();
transactionSampleResult.setSampleLabel(name);
// Assume success