mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Issue #147 : handle corner case as normal failed read rather than AIOOBE
This commit is contained in:
parent
2a8cd871bc
commit
77aabfc457
|
@ -326,28 +326,32 @@ public final class PDF417ScanningDecoder {
|
|||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
|
||||
private static BarcodeValue[][] createBarcodeMatrix(DetectionResult detectionResult) {
|
||||
BarcodeValue[][] barcodeMatrix = new BarcodeValue[detectionResult.getBarcodeRowCount()][detectionResult
|
||||
.getBarcodeColumnCount() + 2];
|
||||
private static BarcodeValue[][] createBarcodeMatrix(DetectionResult detectionResult) throws FormatException {
|
||||
BarcodeValue[][] barcodeMatrix =
|
||||
new BarcodeValue[detectionResult.getBarcodeRowCount()][detectionResult.getBarcodeColumnCount() + 2];
|
||||
for (int row = 0; row < barcodeMatrix.length; row++) {
|
||||
for (int column = 0; column < barcodeMatrix[row].length; column++) {
|
||||
barcodeMatrix[row][column] = new BarcodeValue();
|
||||
}
|
||||
}
|
||||
|
||||
int column = -1;
|
||||
int column = 0;
|
||||
for (DetectionResultColumn detectionResultColumn : detectionResult.getDetectionResultColumns()) {
|
||||
column++;
|
||||
if (detectionResultColumn == null) {
|
||||
continue;
|
||||
}
|
||||
if (detectionResultColumn != null) {
|
||||
for (Codeword codeword : detectionResultColumn.getCodewords()) {
|
||||
if (codeword == null || codeword.getRowNumber() == -1) {
|
||||
continue;
|
||||
if (codeword != null) {
|
||||
int rowNumber = codeword.getRowNumber();
|
||||
if (rowNumber >= 0) {
|
||||
if (rowNumber >= barcodeMatrix.length) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
barcodeMatrix[codeword.getRowNumber()][column].setValue(codeword.getValue());
|
||||
barcodeMatrix[rowNumber][column].setValue(codeword.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
column++;
|
||||
}
|
||||
return barcodeMatrix;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue