Fix small display problem when extension starts with 9
[zxing.git] / core / src / com / google / zxing / oned / UPCAReader.java
index 9b5e9cb..b90c1b8 100644 (file)
 package com.google.zxing.oned;
 
 import com.google.zxing.BarcodeFormat;
-import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
 import com.google.zxing.BinaryBitmap;
+import com.google.zxing.ChecksumException;
+import com.google.zxing.FormatException;
+import com.google.zxing.NotFoundException;
+import com.google.zxing.Result;
 import com.google.zxing.common.BitArray;
 
 import java.util.Hashtable;
@@ -35,19 +37,20 @@ public final class UPCAReader extends UPCEANReader {
   private final UPCEANReader ean13Reader = new EAN13Reader();
 
   public Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, Hashtable hints)
-      throws ReaderException {
+      throws NotFoundException, FormatException, ChecksumException {
     return maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, startGuardRange, hints));
   }
 
-  public Result decodeRow(int rowNumber, BitArray row, Hashtable hints) throws ReaderException {
+  public Result decodeRow(int rowNumber, BitArray row, Hashtable hints)
+      throws NotFoundException, FormatException, ChecksumException {
     return maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, hints));
   }
 
-  public Result decode(BinaryBitmap image) throws ReaderException {
+  public Result decode(BinaryBitmap image) throws NotFoundException, FormatException {
     return maybeReturnResult(ean13Reader.decode(image));
   }
 
-  public Result decode(BinaryBitmap image, Hashtable hints) throws ReaderException {
+  public Result decode(BinaryBitmap image, Hashtable hints) throws NotFoundException, FormatException {
     return maybeReturnResult(ean13Reader.decode(image, hints));
   }
 
@@ -56,16 +59,16 @@ public final class UPCAReader extends UPCEANReader {
   }
 
   protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer resultString)
-      throws ReaderException {
+      throws NotFoundException {
     return ean13Reader.decodeMiddle(row, startRange, resultString);
   }
 
-  private static Result maybeReturnResult(Result result) throws ReaderException {
+  private static Result maybeReturnResult(Result result) throws FormatException {
     String text = result.getText();
     if (text.charAt(0) == '0') {
       return new Result(text.substring(1), null, result.getResultPoints(), BarcodeFormat.UPC_A);
     } else {
-      throw ReaderException.getInstance();
+      throw FormatException.getFormatInstance();
     }
   }