ICEpdf
  1. ICEpdf
  2. PDF-332

JPEGCodec has been removed from JDK 1.7

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.2
    • Fix Version/s: 5.1
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      JDK 1.7, 1.8 or Open JDK

      Description

      We've been using com.sun.image.codec.jpeg.JPEGCodec do do some funky JPEG image detection/loading since the 1.x days. The day has finally come where Oracle has removed the class which has always been a concern for a com.sun package.

      It would be fairly easy to rewrite the JPEGCodec code with something in ImageIO or JAI. ImageIO wasn't always a possibility for us as we used to be JDK 1.3 compliant. There are also some older image libraries like http://java.sun.com/products/jimi/ and http://incubator.apache.org/sanselan/site/index.html that may offer a similar feature set.

        Activity

        Hide
        Patrick Corless added a comment -

        The library appear to be in release 1.7.0_02 of the Oracle JDK on Windows, so I'm not sure where it went in the pre-release versions. An alternative still needs to be found for people using OpenJDK. Right now I'm think we should use reflection to look for the sun API and provide some fall back code for either ImageIO or Apache Sanselan.

        Show
        Patrick Corless added a comment - The library appear to be in release 1.7.0_02 of the Oracle JDK on Windows, so I'm not sure where it went in the pre-release versions. An alternative still needs to be found for people using OpenJDK. Right now I'm think we should use reflection to look for the sun API and provide some fall back code for either ImageIO or Apache Sanselan.
        Hide
        Patrick Corless added a comment -

        Some notes for http://www.icefaces.org/JForum/posts/list/19871.page
        I have a windows setup very similar to above with regards to the ant and java version and could reproduce the error reported.

        So I dug around a bit to try and figure out the problem. The missing classes in question are in the %JAVA_HOME%\jre\lib\rt.jar. So the question is why isn't ant or javac not picking up on the needed classes.

        I ran a >ant -verbose clean build.jars > log.txt

        In the logs shows that %JAVA_HOME%\jre\lib\rt.jar is on the classpath but afterwards there is a statement.

        [javac] Using modern compiler
        dropping C:\java\java\jdk1.7.0_02\jre\jre\lib\rt.jar from path as it doesn't exist

        So I can't tell if this is an ant issue or a JDK issue but if I make sure the path above exists then everything compiles as expected (notice the .\jre\jre\ path).

        If you are running on a 1.7 system then you might want to updated ./examples/etc/build-common.xml 's <javac /> statement to look as follows:

        I have to do some testing still with openJDK to see if its a similar problem.

        Show
        Patrick Corless added a comment - Some notes for http://www.icefaces.org/JForum/posts/list/19871.page I have a windows setup very similar to above with regards to the ant and java version and could reproduce the error reported. So I dug around a bit to try and figure out the problem. The missing classes in question are in the %JAVA_HOME%\jre\lib\rt.jar. So the question is why isn't ant or javac not picking up on the needed classes. I ran a >ant -verbose clean build.jars > log.txt In the logs shows that %JAVA_HOME%\jre\lib\rt.jar is on the classpath but afterwards there is a statement. [javac] Using modern compiler dropping C:\java\java\jdk1.7.0_02\jre\jre\lib\rt.jar from path as it doesn't exist So I can't tell if this is an ant issue or a JDK issue but if I make sure the path above exists then everything compiles as expected (notice the .\jre\jre\ path). If you are running on a 1.7 system then you might want to updated ./examples/etc/build-common.xml 's <javac /> statement to look as follows: I have to do some testing still with openJDK to see if its a similar problem.
        Hide
        Andrea Vacondio added a comment -

        We have been hit by this issue, please have a look here: https://github.com/torakiki/sejda/issues/125

        Show
        Andrea Vacondio added a comment - We have been hit by this issue, please have a look here: https://github.com/torakiki/sejda/issues/125
        Hide
        Patrick Corless added a comment -
        Show
        Patrick Corless added a comment - MOre comments on the forum, http://www.icesoft.org/JForum/posts/list/0/22297.page#78251
        Hide
        Ryan Moore added a comment -

        I would suggest that in addition to targeting Java 7 that Java 8 should also be a target for this fix.

        Show
        Ryan Moore added a comment - I would suggest that in addition to targeting Java 7 that Java 8 should also be a target for this fix.
        Hide
        Patrick Corless added a comment -

        Marking as fixed. QA has passed with no regressions and in genneral many improvements in the quality of the conversions.

        Show
        Patrick Corless added a comment - Marking as fixed. QA has passed with no regressions and in genneral many improvements in the quality of the conversions.
        Hide
        Patrick Corless added a comment -

        A bunch of small fixes have gone into this in the last few days and I'm feeling the imaging is once again stable. One of the last major issue was related to the installation of the JAI on a particular JDK. When installed the following native ImageReaders are installed.

        com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLib
        com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReade

        The problem with these readers is that they can't handle getting the image as a raster. The good news is that a call to canReadRaster() can test for and ignore these readers.

        One of the cool side effects of moving to an more or less pure ImageIO implementation is that other JPEG deocders can be used. This should be useful for the Linux crowd. In my testing the twelvemonkeys API worked very well added to the class path. The following jars are required.

        twelvemonkeys-common-image-3.0.jar
        twelvemonkeys-common-io-3.0.jar
        twelvemonkeys-common-lang-3.0.jar
        twelvemonkeys-common-core3.0.jar
        twelvemonkeys-common-jpeg-3.0.jar
        twelvemonkeys-common-metadata-3.0.jar

        Show
        Patrick Corless added a comment - A bunch of small fixes have gone into this in the last few days and I'm feeling the imaging is once again stable. One of the last major issue was related to the installation of the JAI on a particular JDK. When installed the following native ImageReaders are installed. com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLib com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReade The problem with these readers is that they can't handle getting the image as a raster. The good news is that a call to canReadRaster() can test for and ignore these readers. One of the cool side effects of moving to an more or less pure ImageIO implementation is that other JPEG deocders can be used. This should be useful for the Linux crowd. In my testing the twelvemonkeys API worked very well added to the class path. The following jars are required. twelvemonkeys-common-image-3.0.jar twelvemonkeys-common-io-3.0.jar twelvemonkeys-common-lang-3.0.jar twelvemonkeys-common-core3.0.jar twelvemonkeys-common-jpeg-3.0.jar twelvemonkeys-common-metadata-3.0.jar

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Patrick Corless
          • Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: