mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Tiny update to store string length in var
git-svn-id: https://zxing.googlecode.com/svn/trunk@105 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
852669ced6
commit
0a6ab338b8
|
@ -25,10 +25,11 @@ public final class UPCParsedResult extends ParsedReaderResult {
|
|||
|
||||
public UPCParsedResult(String rawText) {
|
||||
super(ParsedReaderResultType.UPC);
|
||||
if (rawText.length() != 12 && rawText.length() != 13) {
|
||||
int length = rawText.length();
|
||||
if (length != 12 && length != 13) {
|
||||
throw new IllegalArgumentException("Wrong number of digits for UPC");
|
||||
}
|
||||
for (int x = 0; x < rawText.length(); x++) {
|
||||
for (int x = 0; x < length; x++) {
|
||||
char c = rawText.charAt(x);
|
||||
if (c < '0' || c > '9') {
|
||||
throw new IllegalArgumentException("Invalid character found in UPC");
|
||||
|
|
Loading…
Reference in a new issue