I've found another jpeg that exhibits the same issue. It comes from the same source as the previous one, but I do have images from that source that work without issue. Thanks, Cory
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Lewis, Cory (Genworth)
Sent: Wednesday, February 21, 2007 11:00 AM
To: [email protected]
Subject: [iText-questions] Premature EOF in Jpeg.Java
processParameters
Hi all,
I have a jpeg that's causing problems. I'm not sure if it's
borderline invalid or if there is an issue with the code, so here I am.
I call Image.getInstance with a byte[], and get the following
stack trace:
java.io.IOException: Premature EOF while reading JPG.
at com.lowagie.text.Jpeg.processParameters(Jpeg.java:265)
at com.lowagie.text.Jpeg.<init>(Jpeg.java:176)
at com.lowagie.text.Image.getInstance(Image.java:475)
at
com.gefa.services.imaging.core.shared.pdf.iTextPDFConverter.addGenericPa
ge(iTextPDFConverter.java:216)
at
com.gefa.services.imaging.core.shared.pdf.iTextPDFConverter.convertToPDF
(iTextPDFConverter.java:80)
I pulled the code out(processParameters from Jpeg.java) so I
could add some debugging stuff, and got the following:
current shows the current byte from is.read() using
Integer.toHexString(), available shows what is.available() reports.
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O length:
11148
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O current: ff
available: 11145
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O first pass
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O current: ff
available: 11127
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O skipping: 26
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O current: ff
available: 11097
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O skipping:
119
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O current: ff
available: 10974
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O skipping:
119
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O current: ff
available: 10851
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:299 EST] 00000037 SystemOut O skipping:
119
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O current: ff
available: 10728
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O skipping:
119
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O current: ff
available: 10605
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O skipping:
119
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O current: ff
available: 10482
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O skipping:
119
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O current: ff
available: 10359
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O M_APPE
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O skipping: 9
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O current: ff
available: 10223
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O skipping:
130
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O current: ff
available: 10089
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O skipping: 29
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O current: ff
available: 10056
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O skipping:
179
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O current: ff
available: 9873
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:314 EST] 00000037 SystemOut O skipping: 6
[2/21/07 10:32:04:330 EST] 00000037 SystemOut O current: 8b
available: 9863
[2/21/07 10:32:04:330 EST] 00000037 SystemOut O current: ca
available: 9862
...
[2/21/07 10:32:04:861 EST] 00000037 SystemOut O current: 5a
available: 8969
[2/21/07 10:32:04:861 EST] 00000037 SystemOut O current: 60
available: 8968
[2/21/07 10:32:04:861 EST] 00000037 SystemOut O current: 81
available: 8967
[2/21/07 10:32:04:861 EST] 00000037 SystemOut O current: 69
available: 8966
[2/21/07 10:32:04:861 EST] 00000037 SystemOut O current: ff
available: 8965
[2/21/07 10:32:04:861 EST] 00000037 SystemOut O
noparam_marker
[2/21/07 10:32:04:861 EST] 00000037 SystemOut O skipping:
26200
[2/21/07 10:32:04:877 EST] 00000037 SystemOut O current:
ffffffff available: 0
[2/21/07 10:32:04:877 EST] 00000037 LoggerBean E
com.triteksol.util.LoggerBean error Error creating document: Premature
EOF while reading JPG.
java.lang.Exception: Premature
EOF while reading JPG.
at
com.gefa.services.imaging.core.shared.pdf.iTextPDFConverter.processParam
eters(iTextPDFConverter.java:403)
at
com.gefa.services.imaging.core.shared.pdf.iTextPDFConverter.convertToPDF
(iTextPDFConverter.java:78)
at
com.gnw.imaging.imagetype.impl.GenericImage.assemble(GenericImage.java:6
4)
At byte 887 it hits FF, then decides to skip 26200 bytes, which
takes it well past the end of the array, and the next time through the
while loop throws the premature EOF. That noparam_marker is right
before the skip in the
else if (markertype <javascript:searchRef('markertype')> !=
NOPARAM_MARKER <javascript:searchRef('NOPARAM_MARKER')> )
block.
I am attaching the offending jpeg, but I'm not sure if it will
come across. If it doesn't and anyone wants it please email me directly.
I have no problem viewing the jpeg, so like I said, I'm not sure
if it's borderline invalid or there is a code issue.
I'm using 1.4.8.
Any help or insight is greatly appreciated.
Thanks,
Cory
Cory Lewis
Genworth Financial
IT Systems Specialist
(434)522-2120
<<attachment: example2.jpg>>
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
