afpdev / alpheusafpparser

Library & parser for IBM Advanced Function Presentation (AFP) document/print stream format
GNU General Public License v3.0
16 stars 11 forks source link

NegativeArraySizeException when parsing AFP #20

Open mattcg opened 7 years ago

mattcg commented 7 years ago

Thank you for creating this open source library. I'm currently working on an Apache Tika parser for AFP files that wraps the Alpheus AFP parser.

However, none of the documents in my corpus can be parsed. I normally get something like this:

Caused by: com.mgz.afp.exceptions.AFPParserException: An exception occured when parsing structured field at file index position 0x2ebc3.
    at com.mgz.afp.parser.AFPParser.parseNextSF(AFPParser.java:304)
    at org.icij.extract.parser.afp.AlpheusAFPParser.parse(AlpheusAFPParser.java:57)
    ... 8 more
Caused by: java.lang.NegativeArraySizeException
    at com.mgz.afp.parser.AFPParser.parseNextSF(AFPParser.java:241)
    ... 9 more

The file appears to be valid. I can see the magic bytes D3A8 at the beginning and D3A9 at the end. However, I'm not able to view it as I can't find a free AFP viewer for Mac.

If you have a PGP key, could you refer me to it so that I can encrypt one of the AFP files and send it to you?