PDFont.getEncodingManager is not thread safe; FIX included
----------------------------------------------------------
Key: PDFBOX-815
URL: https://issues.apache.org/jira/browse/PDFBOX-815
Project: PDFBox
Issue Type: Bug
Components: PDModel
Affects Versions: 1.3.0
Reporter: Timo Boehme
In class PDFont calling static getEncodingManager is not thread safe. Two
solutions:
(1) with lazy initialization (thread safe with Java 1.5 and later)
private static volatile EncodingManager encodingManager = null;
protected static EncodingManager getEncodingManager() {
if(encodingManager == null) {
synchronized ( PDFont.class ) {
if ( encodingManager == null )
encodingManager = new EncodingManager();
}
}
return encodingManager;
}
(2) create singleton at class initialization time
private static EncodingManager encodingManager = new EncodingManager();
protected static EncodingManager getEncodingManager() {
return encodingManager;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.