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

Michael Groß edited comment on IMAGING-134 at 2/22/15 8:54 PM:
---------------------------------------------------------------

The exception is thrown from 
*org.apache.commons.imaging.formats.jpeg.decoder.JpegInputStream.nextBit()* 
when a marker called *b2* is not 220:
{noformat}
org.apache.commons.imaging.formats.jpeg.JpegConstants

public static final int DNL_MARKER = 0xFFdc;

org.apache.commons.imaging.formats.jpeg.decoder.JpegInputStream.nextBit()

if (b2 == (0xff & JpegConstants.DNL_MARKER)) {
    throw new ImageReadException("DNL not yet supported");
}
throw new ImageReadException("Invalid marker found " + "in entropy data");
{noformat}

0xff & 0xffdc = 0xdc = 220 => if b2 is not 220 then throw an ImageReadException!

So I modified 
*org.apache.commons.imaging.formats.jpeg.decoder.JpegInputStream.nextBit()* to 
print *b2* before the exception is thrown and executed the same test for 
image.jpeg from the issue and _DSC6099.jpg from IMAGING-97:
=== b2 is 208 ===
=== b2 is 208 ===

Both issues are caused by the same problem: *b2* is 208, not 220 as expected. 
Whatever *b2* is - does someone know?




was (Author: mgmechanics):
The exception is thrown from 
*org.apache.commons.imaging.formats.jpeg.decoder.JpegInputStream.nextBit()* 
when a marker called *b2* is not 220:
{noformat}
org.apache.commons.imaging.formats.jpeg.JpegConstants

public static final int DNL_MARKER = 0xFFdc;

org.apache.commons.imaging.formats.jpeg.decoder.JpegInputStream.nextBit()

if (b2 == (0xff & JpegConstants.DNL_MARKER)) {
    throw new ImageReadException("DNL not yet supported");
}
throw new ImageReadException("Invalid marker found " + "in entropy data");
{noformat}

0xff & 0xffdc = 0xdc = 220 => if b2 is not 220 then throw an ImageReadException!

So I modified 
*org.apache.commons.imaging.formats.jpeg.decoder.JpegInputStream.nextBit()* to 
print *b2* before the exception is thrown and executed the same test for 
image.jpeg from the issue and _DSC6099.jpg from IMAGING-97:
=== b2 is 208 ===
=== b2 is 208 ===

Both issues seems to be caused by the same problem: *b2* is 208, not 220 as 
expected. Whatever *b2* is - does someone know?



> Invalid marker found in entropy data
> ------------------------------------
>
>                 Key: IMAGING-134
>                 URL: https://issues.apache.org/jira/browse/IMAGING-134
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: JPEG
>    Affects Versions: 1.0
>            Reporter: John Hewson
>             Fix For: Patch Needed
>
>         Attachments: image.jpeg
>
>
> I'm getting the following exception when trying to read a JPEG:
> Exception in thread "main" org.apache.commons.imaging.ImageReadException: 
> Invalid marker found in entropy data
>       at 
> org.apache.commons.imaging.formats.jpeg.decoder.JpegInputStream.nextBit(JpegInputStream.java:50)
>       at 
> org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder.decode(JpegDecoder.java:426)
>       at 
> org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder.readMCU(JpegDecoder.java:320)
>       at 
> org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder.visitSOS(JpegDecoder.java:124)
>       at 
> org.apache.commons.imaging.formats.jpeg.JpegUtils.traverseJFIF(JpegUtils.java:80)
>       at 
> org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder.decode(JpegDecoder.java:436)
>       at 
> org.apache.commons.imaging.formats.jpeg.JpegImageParser.getBufferedImage(JpegImageParser.java:98)
>       at 
> org.apache.commons.imaging.Imaging.getBufferedImage(Imaging.java:1378)
>       at 
> org.apache.commons.imaging.Imaging.getBufferedImage(Imaging.java:1341)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to