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

Building on OpenJDK throws javax.imageio.IIOException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.0.0
    • PDModel
    • None

    Description

      Originally captured here: http://stackoverflow.com/questions/26531191/pdfbox-throws-writeimage-error-when-building-on-openjdk

      I get this error when building with OpenJDK:

      -------------------------------------------------------------------------------
      Test set: org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest
      -------------------------------------------------------------------------------
      Tests run: 6, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.804 sec <<< FAILURE! - in org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest
      testCreateFromImageINT_ARGB(org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest)  Time elapsed: 0.387 sec  <<< ERROR!
      javax.imageio.IIOException: Invalid argument to native writeImage
              at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
              at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1058)
              at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:360)
              at javax.imageio.ImageWriter.write(ImageWriter.java:615)
              at javax.imageio.ImageIO.doWrite(ImageIO.java:1612)
              at javax.imageio.ImageIO.write(ImageIO.java:1578)
              at org.apache.pdfbox.pdmodel.graphics.image.ValidateXImage.validate(ValidateXImage.java:63)
              at org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest.testCreateFromImageINT_ARGB(JPEGFactoryTest.java:141)
      
      testCreateFromImage4BYTE_ABGR(org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest)  Time elapsed: 0.147 sec  <<< ERROR!
      javax.imageio.IIOException: Invalid argument to native writeImage
              at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
              at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1058)
              at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:360)
              at javax.imageio.ImageWriter.write(ImageWriter.java:615)
              at javax.imageio.ImageIO.doWrite(ImageIO.java:1612)
              at javax.imageio.ImageIO.write(ImageIO.java:1578)
              at org.apache.pdfbox.pdmodel.graphics.image.ValidateXImage.validate(ValidateXImage.java:63)
              at org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest.testCreateFromImage4BYTE_ABGR(JPEGFactoryTest.java:182)
      
      

      I'm aware OpenJDK does not have a native JPEG encoder, and I can build with Oracle JDK:

      JAVA_HOME="/path/to/oracle/jdk" mvn clean compile
      

      Attachments

        1. JPEGFactoryTest.patch
          2 kB
          Martin Schröder

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              opyate Juan Uys
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: