Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4958064

JPGWriter does not throw UnsupportedException when canWriteSequence retuns false

    XMLWordPrintable

Details

    • b56
    • generic
    • generic

    Backports

      Description

        The API Doc for ImageWriter.PrepareWriteSequence() claims that this method will throw UnsupportedOperationException when canWriteSequence() returns false. But this does not seem to be happening for JPEG ImageWriter. JPG writer has failed to override the method canWriteSequence() and relies on the parent class ImageWriter which returns a 'false' value by default. But JPEGImageWriter class has actually implemented the method prepareWriteSequence() and it does not throw UnsupportedOperationException when canWriteSequence() returns false. I feel JPEGImageWriter class must override the method canWriteSequence() and must return a 'true' value since it actually supports the prepareWriteSequence and endWriteSequence() methods. Otherwise it must throw the expected exception - UnsupportedOperationException. This works fine for all other writers.

        This is reproducible on all platforms right from JDK1.4.

        I have attached a sample testcase. Execute the testcase with 'JPG' commandline argument and watch the console for the status messages. If you see a 'FAIL' message the bug is reproduced.

        Attachments

          Issue Links

            Activity

              People

                serb Sergey Bylokhov
                pmohansunw Praveen Mohan (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: