Added some comments and fixed up lines over 100 columns.
[zxing.git] / core / src / com / google / zxing / oned / MultiFormatUPCEANReader.java
index 966654e..502b086 100644 (file)
@@ -27,17 +27,18 @@ import java.util.Vector;
 
 /**
  * <p>A reader that can read all available UPC/EAN formats. If a caller wants to try to
- * read all such formats, it is most efficent to use this implementation rather than invoke
+ * read all such formats, it is most efficient to use this implementation rather than invoke
  * individual readers.</p>
  *
- * @author srowen@google.com (Sean Owen)
+ * @author Sean Owen
  */
 public final class MultiFormatUPCEANReader extends AbstractOneDReader {
 
   private final Vector readers;
 
   public MultiFormatUPCEANReader(Hashtable hints) {
-    Vector possibleFormats = hints == null ? null : (Vector) hints.get(DecodeHintType.POSSIBLE_FORMATS);
+    Vector possibleFormats = hints == null ? null :
+        (Vector) hints.get(DecodeHintType.POSSIBLE_FORMATS);
     readers = new Vector();
     if (possibleFormats != null) {
       if (possibleFormats.contains(BarcodeFormat.EAN_13)) {
@@ -68,7 +69,7 @@ public final class MultiFormatUPCEANReader extends AbstractOneDReader {
       UPCEANReader reader = (UPCEANReader) readers.elementAt(i);
       Result result;
       try {
-        result = reader.decodeRow(rowNumber, row, startGuardPattern);
+        result = reader.decodeRow(rowNumber, row, startGuardPattern, hints);
       } catch (ReaderException re) {
         continue;
       }
@@ -82,13 +83,15 @@ public final class MultiFormatUPCEANReader extends AbstractOneDReader {
       // a UPC-A code. But for efficiency we only run the EAN-13 decoder to also read
       // UPC-A. So we special case it here, and convert an EAN-13 result to a UPC-A
       // result if appropriate.
-      if (result.getBarcodeFormat().equals(BarcodeFormat.EAN_13) && result.getText().charAt(0) == '0') {
-        return new Result(result.getText().substring(1), null, result.getResultPoints(), BarcodeFormat.UPC_A);
+      if (result.getBarcodeFormat().equals(BarcodeFormat.EAN_13) &&
+          result.getText().charAt(0) == '0') {
+        return new Result(result.getText().substring(1), null, result.getResultPoints(),
+            BarcodeFormat.UPC_A);
       }
       return result;
     }
 
-    throw new ReaderException("No barcode was detected in this image.");
+    throw ReaderException.getInstance();
   }
 
 }