Details
Description
Jeff Caswell's patch applied:
We have been having a number of issues with story parameter conversion and number format errors in a multithreaded environment.
This was tracked back to the java.text.NumberFormat instance held by the ParameterConverters NumberConverter inner class.
The constructor is only run once when a number of stories are launched and the instance is used by all the stories in the run.
I suspect there may be other issues affecting this, however by converting the NumberFormat to ThreadLocal storage has solved the problem here.
The patch is pretty much self explanitory, the only aspect that may not immediately seem obvious is that the NumberFormat passed in on the constructor was itself constructed with the users preferred Locale. It is for this reason that I have treated it as the 'preferred format' and cloned it for the thread local copy. Also I did not issue an explicit remove since tests are run as a relatively short lived batch job and I did not feel that there was any reason to worry about an associated memory leak.
Activity
Field | Original Value | New Value |
---|---|---|
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Summary | ParameterConverters not threadsafe | NumberConverter not threadsafe |
Affects Version/s | 3.6 [ 17721 ] |
Fix Version/s | 3.7 [ 18390 ] |
Minor renames of https://github.com/swa-jcaswell/jbehave-core/commit/0b53a815f2a99a9944d7afc697d402ab50be106b.
In particular, renamed preferredNumberFormat -> numberFormat and numberFormat -> threadLocalNumberFormat.