syntacticsplenda / jbig2-imageio

Automatically exported from code.google.com/p/jbig2-imageio
0 stars 0 forks source link

Can't instantiate segment class exception #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Extract jbig2 images from pdf document.
2. Try to convert the resulting jbig2 images to jpeg.
3.

What is the expected output? What do you see instead?

I get an exception: 

Exception in thread "main" java.lang.RuntimeException: Can't instantiate 
segment class
    at com.levigo.jbig2.SegmentHeader.getSegmentData(SegmentHeader.java:405)
    at com.levigo.jbig2.JBIG2Page.createNormalPage(JBIG2Page.java:182)
    at com.levigo.jbig2.JBIG2Page.createPage(JBIG2Page.java:154)
    at com.levigo.jbig2.JBIG2Page.composePageBitmap(JBIG2Page.java:145)
    at com.levigo.jbig2.JBIG2Page.getBitmap(JBIG2Page.java:125)
    at com.levigo.jbig2.JBIG2ImageReader.read(JBIG2ImageReader.java:223)
    at Execute.decode(Execute.java:73)
    at Execute.main(Execute.java:31)
Caused by: java.lang.ClassCastException: 
com.levigo.jbig2.decoder.huffman.ValueNode cannot be cast to 
com.levigo.jbig2.decoder.huffman.InternalNode
    at com.levigo.jbig2.decoder.huffman.InternalNode.append(InternalNode.java:94)
    at com.levigo.jbig2.decoder.huffman.InternalNode.append(InternalNode.java:94)
    at com.levigo.jbig2.decoder.huffman.InternalNode.append(InternalNode.java:94)
    at com.levigo.jbig2.decoder.huffman.InternalNode.append(InternalNode.java:94)
    at com.levigo.jbig2.decoder.huffman.InternalNode.append(InternalNode.java:94)
    at com.levigo.jbig2.decoder.huffman.InternalNode.append(InternalNode.java:94)
    at com.levigo.jbig2.decoder.huffman.InternalNode.append(InternalNode.java:94)
    at com.levigo.jbig2.decoder.huffman.HuffmanTable.initTree(HuffmanTable.java:68)
    at com.levigo.jbig2.decoder.huffman.FixedSizeTable.<init>(FixedSizeTable.java:30)
    at com.levigo.jbig2.segments.TextRegion.symbolIDCodeLengths(TextRegion.java:892)
    at com.levigo.jbig2.segments.TextRegion.computeSymbolCodeLength(TextRegion.java:255)
    at com.levigo.jbig2.segments.TextRegion.parseHeader(TextRegion.java:153)
    at com.levigo.jbig2.segments.TextRegion.init(TextRegion.java:901)
    at com.levigo.jbig2.SegmentHeader.getSegmentData(SegmentHeader.java:400)
    ... 7 more

What version of the product are you using? On what operating system?

levigo-jbig2-imageio-1.6.1.jar    on Windows XP SP3

Please provide any additional information below.

I have two sample PDF documents containing four jbig2 images in total, which 
are causing this exception. However, these documents belong to our client and I 
cannot supply them to you. I can give you any debugging information that you 
might need to fix this issue. These jbig2 images look perfectly fine in the 
original PDF documents.

Original issue reported on code.google.com by Illya.Ra...@gmail.com on 17 Jun 2013 at 4:15

GoogleCodeExporter commented 8 years ago
Attaching my Java program.

Original comment by Illya.Ra...@gmail.com on 17 Jun 2013 at 4:30

Attachments:

GoogleCodeExporter commented 8 years ago
Attaching a sample jbig2 image file.

Original comment by Illya.Ra...@gmail.com on 17 Jun 2013 at 5:04

Attachments:

GoogleCodeExporter commented 8 years ago
Seems to be a problem with user specified huffman tables.

Original comment by matthaeu...@gmail.com on 19 Jun 2013 at 9:20

GoogleCodeExporter commented 8 years ago
Segment structure:
#SegmentNr: 0 
 SegmentType: 0 (Symbol Dictionary)
 PageAssociation: 0
 Referred-to segments: none
#SegmentNr: 1 
 SegmentType: 48 (Page Information)
 PageAssociation: 1
 Referred-to segments: none
#SegmentNr: 2 
 SegmentType: 0 (Symbol Dictionary)
 PageAssociation: 1
 Referred-to segments: none
#SegmentNr: 3
 SegmentType: 53 (Tables)
 PageAssociation: 1
 Referred-to segments: none
#SegmentNr: 4
 SegmentType: 6 (Immediate Text Region)
 PageAssociation: 1
 Referred-to segments: 0 2 3 
#SegmentNr: 5
 SegmentType: 50 (End of Stripe)
 PageAssociation: 1
 Referred-to segments: none
#SegmentNr: 6
 SegmentType: 6 (Immediate Text Region)
 PageAssociation: 1
 Referred-to segments: 0 2

Original comment by matthaeu...@gmail.com on 19 Jun 2013 at 12:11

GoogleCodeExporter commented 8 years ago
Attaching PDF document containing a sample jbig2 image file.

Original comment by Illya.Ra...@gmail.com on 19 Jun 2013 at 3:02

Attachments:

GoogleCodeExporter commented 8 years ago
For the next two weeks I'm in holidays. I'll take a closer look when I'm back.

Original comment by matthaeu...@gmail.com on 21 Jun 2013 at 9:08

GoogleCodeExporter commented 8 years ago
Is anyone looking into this issue? Thank you.

Original comment by Illya.Ra...@gmail.com on 23 Aug 2013 at 8:06

GoogleCodeExporter commented 8 years ago
Hi.

I`m getting the exact same problem. Currently I`m using the HEAD of the master 
branch on the repository (1.6.4-SNAPSHOT as it was in 2015-02-11 ).

Original comment by lis...@scvpartner.com.br on 11 Feb 2015 at 7:21