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

COSName.hashCode initialized after put to cache, instead before

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.21
    • Fix Version/s: 2.0.22, 3.0.0 PDFBox
    • Component/s: Parsing
    • Labels:
      None

      Description

      In the constructor org.apache.pdfbox.cos.COSName.COSName(String, boolean), the field COSNam.hashCode becomes initialized after the COSName instance has been added to the cache.

      Thus, concurrent threads using the cached instance may see different values in COSName.hashCode().

       

      Just to mention, that's another problem:
      The whole caching is quite dirty, because it leaks memory if the application is not aware of calling COSName.clearResources().
      Ideally, the class COSName would not exist at all, since it has no benefit over using strings directly. Of course, it would be quite a hard work to get rid of it.

       

        Attachments

          Activity

            People

            • Assignee:
              lehmi Andreas Lehmkühler
              Reporter:
              joerg.wassmer Jörg Waßmer
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: