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.
|