Menu

#26 ArrayIndexOutOfBoundsException during EAN128 encoding

open
5
2008-01-23
2008-01-23
mkazancev
No

Hello,

If i try to create an EAN 128 barcode containing certain values (for example 0000000000Ku1RM1KH1GO1Tc1LN1Ne1Hx1KW1NH1SW1DU1gh0GI1Gy1Rs1qljL11G11R01BS11l15oTSf1Sg1nhAIl1Ej1Wn1arJ9hMYe1XG1Mv1PW1CW1LZ1Iw1TA1WA18) with the actual Barbecue 1.5 beta 1 build, an ArrayIndexOutOfBoundsException is thrown.

Reproduction workflow:

Create a test class and enbed the follwing code line into it:

final Barcode barcode = BarcodeFactory.createEAN128("0000000000Ku1RM1KH1GO1Tc1LN1Ne1Hx1KW1NH1SW1DU1gh0GI1Gy1Rs1qljL11G11R01BS11l15oTSf1Sg1nhAIl1Ej1Wn1arJ9hMYe1XG1Mv1PW1CW1LZ1Iw1TA1WA18");

Expected result:

The following exception should be thrown:
java.lang.ArrayIndexOutOfBoundsException: -17
at java.util.ArrayList.get(ArrayList.java:326)
at net.sourceforge.barbecue.linear.code128.ModuleFactory.getModuleForIndex(Unknown Source)
at net.sourceforge.barbecue.linear.code128.Code128Barcode.encodeData(Unknown Source)
at net.sourceforge.barbecue.linear.LinearBarcode.draw(Unknown Source)
at net.sourceforge.barbecue.Barcode.calculateSize(Unknown Source)
at net.sourceforge.barbecue.Barcode.getActualSize(Unknown Source)
at net.sourceforge.barbecue.Barcode.getWidth(Unknown Source)

Kind regards,
Michael

Discussion


Log in to post a comment.