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

IndexOutOfBoundsException when calling PDSeparation.setAlternateColorSpace

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.9, 1.8.10, 2.0.0
    • Fix Version/s: 1.8.10, 2.0.0
    • Component/s: PDModel
    • Labels:

      Description

      From Floris in the user mailing list:

      I am trying to define a Separation color space but get the following error message if I try to run the program posted beneath. The error seems to be quite local; coming only from the setAlternateColorSpace. What is going on here? I am using org.apache.pdfbox:pdfbox:app-1.8.10-20150327.210556-4 (in this version DeviceN is working) and java version 1.8.0_40-ea.

      Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
          at java.util.ArrayList.rangeCheck(ArrayList.java:653)
          at java.util.ArrayList.set(ArrayList.java:444)
          at org.apache.pdfbox.cos.COSArray.set(COSArray.java:148)
          at org.apache.pdfbox.pdmodel.graphics.color.PDSeparation.setAlternateColorSpace(PDSeparation.java:182)
          at com.here.devicentest.DeviceNTest.WriteSeprationPDF(DeviceNTest.java:463)
          at com.here.devicentest.DeviceNTest.main(DeviceNTest.java:43) 
      

      The cause is this initialisation:

      public PDSeparation()
          {
              array = new COSArray();
              array.add( COSName.SEPARATION );
              array.add( COSName.getPDFName( "" ) );
          }
      

      However the separation colorspace has 4 elements.

        Attachments

          Activity

            People

            • Assignee:
              tilman Tilman Hausherr
              Reporter:
              tilman Tilman Hausherr
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: