[ 
https://issues.apache.org/jira/browse/IMAGING-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13707391#comment-13707391
 ] 

Nicolas Desessart edited comment on IMAGING-108 at 7/13/13 9:02 AM:
--------------------------------------------------------------------

The problem is in the TiffReader class in the private method 
getJpegRawImageData.
{code:title=TiffReader.getJpegRawImageData(ByteSource,TiffDirectory) throws 
ImageReadException, IOException|borderStyle=solid}
        // check if the last read byte is actually the end of the image data
        if (length < 2 ||
                (((data[data.length - 2] & 0xff) << 8) | (data[data.length - 1] 
& 0xff)) != JpegConstants.EOIMarker) {
            throw new ImageReadException("JPEG EOI marker could not be found at 
expected location");
        }
{code}
I also had to comment out those lines because some photo editors (eg. Photoshop 
CS5) or publishing tools may damage the OEI marker.
I see no reason to check if the image isn't corrupted instead of doing best 
effort reading. Especially in a private method used by core mechanisms, which 
means no overriding possibility.
This error didn't occur in Sanselan.
This should really be fixed. :)

                
      was (Author: doh):
    The problem is in the TiffReader class in the private method 
getJpegRawImageData.
{code:title=TiffReader.getJpegRawImageData(ByteSource,TiffDirectory) throws 
ImageReadException, IOException|borderStyle=solid}
        // check if the last read byte is actually the end of the image data
        if (length < 2 ||
                (((data[data.length - 2] & 0xff) << 8) | (data[data.length - 1] 
& 0xff)) != JpegConstants.EOIMarker) {
            throw new ImageReadException("JPEG EOI marker could not be found at 
expected location");
        }
{code}
I also had to comment out those lines because some images editors or transfer 
tools may damage the OEI marker.
I see no reason to check if the image isn't corrupted instead of doing best 
effort reading. Especially in a private method used by core mechanisms, which 
means no overriding possibility.
This error didn't occur in Sanselan.
This should really be fixed. :)

                  
> JPEG EOI marker could not be found at expected location
> -------------------------------------------------------
>
>                 Key: IMAGING-108
>                 URL: https://issues.apache.org/jira/browse/IMAGING-108
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: JPEG
>         Environment: Windows
>            Reporter: Petr Nejedly
>         Attachments: Christmas 2004 Matt 002.jpg
>
>
> Getting the above exception when calling
> ImageInfo imageInfo = Imaging.getImageInfo(f.getInputStream(), 
> f.getFilename());
> for the attached file.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to