diff --git a/core/src/main/java/com/google/zxing/DecodeHintType.java b/core/src/main/java/com/google/zxing/DecodeHintType.java index 90d0a3e02..a6658695e 100644 --- a/core/src/main/java/com/google/zxing/DecodeHintType.java +++ b/core/src/main/java/com/google/zxing/DecodeHintType.java @@ -32,7 +32,7 @@ public enum DecodeHintType { /** * Unspecified, application-specific hint. Maps to an unspecified {@link Object}. */ - OTHER(Object.class), + OTHER(Object.class), /** * Image is a pure monochrome image of a barcode. Doesn't matter what it maps to; @@ -90,12 +90,13 @@ public enum DecodeHintType { /** - * Allowed extension lengths for EAN or UPC barcodes. - * Other formats will ignore this. + * Allowed extension lengths for EAN or UPC barcodes. Other formats will ignore this. * Maps to an {@code int[]} of the allowed extension lengths, for example [2], [5], or [2, 5]. - * If it is optional to have an extension, do not set this hint. + * If it is optional to have an extension, do not set this hint. If this is set, + * and a UPC or EAN barcode is found but an extension is not, then no result will be returned + * at all. */ - ALLOWED_EAN_EXTENSIONS(int[].class); + ALLOWED_EAN_EXTENSIONS(int[].class), // End of enumeration values. ; diff --git a/core/src/main/java/com/google/zxing/oned/UPCEANReader.java b/core/src/main/java/com/google/zxing/oned/UPCEANReader.java index 349d4632d..5316e6d53 100644 --- a/core/src/main/java/com/google/zxing/oned/UPCEANReader.java +++ b/core/src/main/java/com/google/zxing/oned/UPCEANReader.java @@ -206,17 +206,17 @@ public abstract class UPCEANReader extends OneDReader { // continue } - int[] allowedExtensions = hints == null ? null : - (int[])hints.get(DecodeHintType.ALLOWED_EAN_EXTENSIONS); - if(allowedExtensions != null) { + int[] allowedExtensions = + hints == null ? null : (int[]) hints.get(DecodeHintType.ALLOWED_EAN_EXTENSIONS); + if (allowedExtensions != null) { boolean valid = false; for (int length : allowedExtensions) { - if(extensionLength == length) { + if (extensionLength == length) { valid = true; break; } } - if(!valid) { + if (!valid) { throw NotFoundException.getNotFoundInstance(); } }