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

COS 'primitive' types are mutable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.8.8, 1.8.9, 2.0.0
    • 3.0.0 PDFBox
    • None
    • None

    Description

      From torakiki:
      They are cached and they are mutable so this:

              COSInteger cosint = COSInteger.get(10);
              cosint.setValue(50);
              //lets move to a totally unrelated part of my software
              System.out.println(COSInteger.get(10));
      

      prints COSInteger(50) so basically I ask for a 10 and get a 50, isn't it weird (and error prone)? ... or the way around, I call cosint.setValue(50) at some point in the software and that makes it a 50 everywhere I used COSInteger.get(10).

      That's of course also true for the other mutable attributes setDirect and setNeedToBeUpdate.

      Attachments

        Issue Links

          Activity

            People

              msahyoun Maruan Sahyoun
              tilman Tilman Hausherr
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: