I understand that PDFBox is not yet thread-safe, however, from reading this comment on a similar ticket, it seems like the fonts should be thread safe and is something that we want to fix. However, I am experiencing an intermittent NullPointerException when running multi-threaded unit tests that attempt to read several PDFs at once (see details here.
Inside FontMapperImpl.java the getProvider and setProvider methods are synchronised:
However, the calling code from the findFont() method is not synchronised:
As a result, if multiple threads attempt to access this at once, thread A may be in the setProvider method and have set fontProvider, but still processing the creation of fontInfoByName - so thread B could attempt to access before initialised.