Merge pull request #453 from graug/dev

Ignore additional PDF417 barcode rows, https://github.com/zxing/zxing/issues/449
This commit is contained in:
Sean Owen 2015-09-01 14:30:44 +01:00
commit c44ee5e587
5 changed files with 7 additions and 4 deletions

View file

@ -122,7 +122,8 @@ final class DetectionResultRowIndicatorColumn extends DetectionResultColumn {
if (codeword != null) { if (codeword != null) {
int rowNumber = codeword.getRowNumber(); int rowNumber = codeword.getRowNumber();
if (rowNumber >= result.length) { if (rowNumber >= result.length) {
throw FormatException.getFormatInstance(); // We have more rows than the barcode metadata allows for, ignore them.
continue;
} }
result[rowNumber]++; result[rowNumber]++;
} // else throw exception? } // else throw exception?

View file

@ -343,7 +343,8 @@ public final class PDF417ScanningDecoder {
int rowNumber = codeword.getRowNumber(); int rowNumber = codeword.getRowNumber();
if (rowNumber >= 0) { if (rowNumber >= 0) {
if (rowNumber >= barcodeMatrix.length) { if (rowNumber >= barcodeMatrix.length) {
throw FormatException.getFormatInstance(); // We have more rows than the barcode metadata allows for, ignore them.
continue;
} }
barcodeMatrix[rowNumber][column].setValue(codeword.getValue()); barcodeMatrix[rowNumber][column].setValue(codeword.getValue());
} }

View file

@ -29,8 +29,8 @@ public final class PDF417BlackBox1TestCase extends AbstractBlackBoxTestCase {
public PDF417BlackBox1TestCase() { public PDF417BlackBox1TestCase() {
super("src/test/resources/blackbox/pdf417-1", new MultiFormatReader(), BarcodeFormat.PDF_417); super("src/test/resources/blackbox/pdf417-1", new MultiFormatReader(), BarcodeFormat.PDF_417);
addTest(9, 9, 0.0f); addTest(10, 10, 0.0f);
addTest(9, 9, 180.0f); addTest(10, 10, 180.0f);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -0,0 +1 @@
This is just a test.