Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTypeHandlerSupport not thread-safe #131

Closed
GoogleCodeExporter opened this issue Mar 27, 2015 · 1 comment
Closed

DateTypeHandlerSupport not thread-safe #131

GoogleCodeExporter opened this issue Mar 27, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create multiple Unmarshallers (one per thread) from the same StreamFactory
2. Unmarshall records with a date in each of the threads

What is the expected output? What do you see instead?
All records get unmarshalled correctely. Instead, Exceptions get thrown.

What version of BeanIO are you using? What JDK version?
BeanIO 2.1.0

Please provide any additional information below.
While the documentation claims that "All included BeanIO type handlers are 
thread safe", DateTypeHandlerSupport potentially uses the same SimpleDateFormat 
for multiple Unmarshaller instances. Since SimpleDateFormat is not thread-safe 
this causes the behaviour as shown. Switching to a custom TypeHandler that uses 
a thread-local SimpleDateFormat solves the problem.

Original issue reported on code.google.com by gyr...@gmail.com on 24 Mar 2015 at 12:58

@bjansen
Copy link
Collaborator

bjansen commented Mar 11, 2021

Actual fix was in ba80ca4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants