|Summary:||HttpSamplerBase#errorResult modifies sampleResult passed as parameter|
|Product:||JMeter||Reporter:||Philippe Mouawad <p.mouawad>|
|Component:||HTTP||Assignee:||JMeter issues mailing list <issues>|
|Version:||Nightly (Please specify date)|
|Bug Depends on:|
Description Philippe Mouawad 2012-01-01 21:59:41 UTC
Concerns r1210141 Is it regular that HttpSamplerBase#errorResult modifies the parameter SampleResult instead of creating one ? - For example, in downloadPageResources in case of HTMLParseException, res.addSubResult(errorResult(e, res)); will add a SubResult that is the same as ParentResult. - In same method, same issue if ClassCastException occurs - Same in cas of TimeoutException - Same issue in resultProcessing
Comment 1 Sebb 2012-01-05 12:49:30 UTC
The idea of the method was to simplify setting up all the required fields. Most samplers start by creating an empty sampleResult; if the sample fails, this needs to be populated with the error details. The way it is used in downloadPageResources is incorrect; that should create a new result first. It was probably a mistake for the method to return the sampleResult, but changing this might cause user code to break. Perhaps there need to be two new methods: - createErrorResult, which returns a SampleResult - setUpErrorResult, which populates an existing SampleResult and returns void. In the meantime, I will fix the incorrect calls where the method is used to create a sub-result.
Comment 2 Sebb 2012-01-05 13:17:52 UTC
Note: an alternative solution would be to always create a new SampleResult from the passed-in parameter, but that seems rather wasteful, and would change the class in some cases.
Comment 3 Sebb 2012-01-05 13:24:07 UTC
(In reply to comment #2) > Note: an alternative solution would be to always create a new SampleResult from Correction: that should be HTTPSampleResult > the passed-in parameter, but that seems rather wasteful, and would change the > class in some cases. Correction: would not change the class, unless HTTPSampleResult is ever sub-classed.
Comment 4 Sebb 2012-01-05 13:51:42 UTC
Added fix for incorrect subsample calls: URL: http://svn.apache.org/viewvc?rev=1227584&view=rev Log: Bug 52409 - HttpSamplerBase#errorResult modifies sampleResult passed as parameter; fix code which assumes that a new instance is created (i.e. when adding a sub-sample) Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java jmeter/trunk/xdocs/changes.xml Leaving open for now, in case there are any other needed changes.
Comment 5 Philippe Mouawad 2012-01-20 22:25:20 UTC
I close issue as it seems ok for me.