Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-815

PDFont.getEncodingManager is not thread safe; FIX included

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.3.1
    • Component/s: PDModel
    • Labels:
      None

      Description

      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; }

        Attachments

          Activity

            People

            • Assignee:
              jukkaz Jukka Zitting
              Reporter:
              tboehme Timo Boehme
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified