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

ClassCastException in PDCalGray: COSFloat cannot be cast to COSArray

    XMLWordPrintableJSON

Details

    Description

      INFORMATION: Rendering: PDFBOX-1724.pdf
      java.lang.ClassCastException: org.apache.pdfbox.cos.COSFloat cannot be cast to org.apache.pdfbox.cos.COSArray
      	at org.apache.pdfbox.pdmodel.graphics.color.PDCalRGB.getGamma(PDCalRGB.java:158)
      	at org.apache.pdfbox.pdmodel.graphics.color.PDCalRGB.toRGB(PDCalRGB.java:95)
      	at org.apache.pdfbox.pdmodel.graphics.color.PDCalGray.toRGB(PDCalGray.java:81)
      	at org.apache.pdfbox.pdmodel.graphics.color.PDCIEBasedColorSpace.toRGBImage(PDCIEBasedColorSpace.java:88)
      

      The cause is that in one of the redesigns it was overseen that the Gamma is a single value for CalGray, and not an array like in CalRGB. Thus PDCalGray cannot be extended from PDCalRGB. The bug didn't have an effect because the gamma wasn't used before PDFBOX-2553. Instead I will extend it from PDCIEBasedColorSpace or from a new abstract class PDCalBasedColorSpace.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tilman Tilman Hausherr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: