manuelbl / SwissQRBill

Java library for Swiss QR bill payment slips (aka QR-Rechnung)
https://www.codecrete.net/qrbill
MIT License
155 stars 37 forks source link

SwicoS1Decoder not threadsafe #84

Closed alvegh closed 1 year ago

alvegh commented 1 year ago

Hey,

Just wanted to give a little headsup - the subject says it.

I am using the SwicoS1Decoder to parse the contents of a QR Code , and in heavy server use this proved out to be flaky

The reason is the SWICO_NUMBER_FORMAT global static

java.text.DecimalFormat is famously not threadsafe

My solution is to declare that static as a ThreadLocal which fixes at least my usecase.

I am not using the SwicoS1Encoder, but it looks like it has the same problem

Regards Alex

manuelbl commented 1 year ago

Thank you for reporting this. I wasn't aware of this DecimalFormat issue.

manuelbl commented 1 year ago

This issue has been fixed in version 3.0.7.