mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Handle invalid VIN-like data in Code 39 barcodes
This commit is contained in:
parent
4411eb5517
commit
5d5a8e20fc
|
@ -41,10 +41,10 @@ public final class VINResultParser extends ResultParser {
|
|||
if (!AZ09.matcher(rawText).matches()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if (!checkChecksum(rawText)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String wmi = rawText.substring(0, 3);
|
||||
return new VINParsedResult(rawText,
|
||||
wmi,
|
||||
|
@ -55,6 +55,9 @@ public final class VINResultParser extends ResultParser {
|
|||
modelYear(rawText.charAt(9)),
|
||||
rawText.charAt(10),
|
||||
rawText.substring(11));
|
||||
} catch (IllegalArgumentException iae) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean checkChecksum(CharSequence vin) {
|
||||
|
|
Loading…
Reference in a new issue